/** * Returns whether the given block is one pointed-to by a file. */ private boolean isValidBlock(Block b) { BlockInfo bi = blockManager.getStoredBlock(b); return bi != null && bi.getBlockCollectionId() != INodeId.INVALID_INODE_ID; } }
BlockCollection getBlockCollection(BlockInfo b) { return namesystem.getBlockCollection(b.getBlockCollectionId()); }
INodeFile getBlockCollection(BlockInfo b) { return getBlockCollection(b.getBlockCollectionId()); }
/** * Remove the block from the block map; * remove it from all data-node lists it belongs to; * and remove all data-node locations associated with the block. */ void removeBlock(BlockInfo block) { BlockInfo blockInfo = blocks.remove(block); if (blockInfo == null) { return; } decrementBlockStat(block); assert blockInfo.getBlockCollectionId() == INodeId.INVALID_INODE_ID; final int size = blockInfo.isStriped() ? blockInfo.getCapacity() : blockInfo.numNodes(); for(int idx = size - 1; idx >= 0; idx--) { DatanodeDescriptor dn = blockInfo.getDatanode(idx); if (dn != null) { removeBlock(dn, blockInfo); // remove from the list and wipe the location } } }
long bcId = block.getBlockCollectionId(); if (bcId == INodeId.INVALID_INODE_ID) {
if (namesystem.isInSnapshot(storedBlock.getBlockCollectionId())) { int numOfReplicas = storedBlock.getUnderConstructionFeature() .getNumExpectedLocations();