boolean detachBlock(int namespaceId, Block block, int numLinks) throws IOException {
    if (isDetached()) {
      return false;
    }
    if (blockDataFile.getFile() == null || blockDataFile.volume == null) {
      throw new IOException("detachBlock:Block not found. " + block);
    }

    File meta = null;
    if (!inlineChecksum) {
      meta = BlockWithChecksumFileWriter.getMetaFile(blockDataFile.getFile(), block);
      if (meta == null) {
        throw new IOException("Meta file not found for block " + block);
      }
    }

    if (HardLink.getLinkCount(blockDataFile.getFile()) > numLinks) {
      DataNode.LOG.info("CopyOnWrite for block " + block);
      detachFile(namespaceId, blockDataFile.getFile(), block);
    }
    if (!inlineChecksum) {
      if (HardLink.getLinkCount(meta) > numLinks) {
        detachFile(namespaceId, meta, block);
      }
    }
    setDetached();
    return true;
  }
boolean detachBlock ( int namespaceId , Block block , int numLinks ) throws IOException { if ( isDetached ( ) ) { return false ; } if ( blockDataFile . getFile ( ) == null || blockDataFile . volume == null ) { throw new IOException ( "detachBlock:Block not found. " + block ) ; } File meta = null ; if ( ! inlineChecksum ) { meta = BlockWithChecksumFileWriter . getMetaFile ( blockDataFile . getFile ( ) , block ) ; if ( meta == null ) { throw new IOException ( "Meta file not found for block " + block ) ; } } if ( HardLink . getLinkCount ( blockDataFile . getFile ( ) ) > numLinks ) { DataNode . LOG . info ( "CopyOnWrite for block " + block ) ; detachFile ( namespaceId , blockDataFile . getFile ( ) , block ) ; } if ( ! inlineChecksum ) { if ( HardLink . getLinkCount ( meta ) > numLinks ) { detachFile ( namespaceId , meta , block ) ; } } setDetached ( ) ; return true ; }
Returns true if this block was copied, otherwise returns false.