boolean removeBlock(String path, INodeFileUnderConstruction fileNode,
                      Block block) throws IOException {
    waitForReady();

    writeLock();
    try {
      // modify file-> block and blocksMap
      fileNode.removeBlock(block);
      getFSNamesystem().blocksMap.removeBlock(block);
      // Remove the block from corruptReplicasMap
      getFSNamesystem().corruptReplicas.removeFromCorruptReplicasMap(block);

      // write modified block locations to log
      fsImage.getEditLog().logOpenFile(path, fileNode);
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("DIR* FSDirectory.removeBlock: "
                                      +path+" with "+block
                                      +" block is removed from the file system");
      }
    } finally {
      writeUnlock();
    }
    return true;
  }
boolean removeBlock ( String path , INodeFileUnderConstruction fileNode , Block block ) throws IOException { waitForReady ( ) ; writeLock ( ) ; try { fileNode . removeBlock ( block ) ; getFSNamesystem ( ) . blocksMap . removeBlock ( block ) ; getFSNamesystem ( ) . corruptReplicas . removeFromCorruptReplicasMap ( block ) ; fsImage . getEditLog ( ) . logOpenFile ( path , fileNode ) ; if ( NameNode . stateChangeLog . isDebugEnabled ( ) ) { NameNode . stateChangeLog . debug ( "DIR* FSDirectory.removeBlock: " + path + " with " + block + " block is removed from the file system" ) ; } } finally { writeUnlock ( ) ; } return true ; }
Remove the block from a file.