code: public void checkDataDir() throws DiskErrorException {
      long total_blocks=0, removed_blocks=0;
      List<FSVolume> failed_vols = null;
  
      failed_vols = volumes.checkDirs();
  
      //if there no failed volumes return
      if(failed_vols == null) 
        return;
      
      // else 
      // remove related blocks
      long mlsec = System.currentTimeMillis();
      lock.writeLock().lock();
      try {
        volumeMap.removeUnhealthyVolumes(failed_vols);
      } finally {
        lock.writeLock().unlock();
      }
      mlsec = System.currentTimeMillis() - mlsec;
      DataNode.LOG.warn(">>>>>>>>>>>>Removed " + removed_blocks + " out of " + total_blocks +
          "(took " + mlsec + " millisecs)");
  
      // report the error
      StringBuilder sb = new StringBuilder();
      for(FSVolume fv : failed_vols) {
        sb.append(fv.toString() + ";");
      }
  
      throw  new DiskErrorException("DataNode failed volumes:" + sb);
    
    }
docs: check if a data directory is healthy
  if some volumes failed - make sure to remove all the blocks that belong
  to these volumes
  @throws DiskErrorException