public static void updateBlocksMap(INodeFile file, BlockManager bm) { // Add file->block mapping final BlockInfo[] blocks = file.getBlocks(); if (blocks != null) { for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollectionWithCheck(blocks[i], file)); } } }
public void updateBlocksMap(INodeFile file) { // Add file->block mapping final BlockInfo[] blocks = file.getBlocks(); if (blocks != null) { final BlockManager bm = namesystem.getBlockManager(); for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollectionWithCheck(blocks[i], file)); } } }
void setLastBlock(BlockInfo blk) { blk.setBlockCollectionId(this.getId()); setBlock(numBlocks() - 1, blk); }
oldnode.setBlock(oldnode.numBlocks() - 1, info);
public static void updateBlocksMap(INodeFile file, BlockManager bm) { // Add file->block mapping final BlockInfoContiguous[] blocks = file.getBlocks(); if (blocks != null) { for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollection(blocks[i], file)); } } }
public static void updateBlocksMap(INodeFile file, BlockManager bm) { // Add file->block mapping final BlockInfoContiguous[] blocks = file.getBlocks(); if (blocks != null) { for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollection(blocks[i], file)); } } }
file.setBlock(file.numBlocks() - 1, ucBlk);
public void updateBlocksMap(INodeFile file) { // Add file->block mapping final BlockInfoContiguous[] blocks = file.getBlocks(); if (blocks != null) { final BlockManager bm = namesystem.getBlockManager(); for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollection(blocks[i], file)); } } }
@Override // BlockCollection, the file should be under construction public BlockInfoContiguousUnderConstruction setLastBlock( BlockInfoContiguous lastBlock, DatanodeStorageInfo[] locations) throws IOException { Preconditions.checkState(isUnderConstruction(), "file is no longer under construction"); if (numBlocks() == 0) { throw new IOException("Failed to set last block: File is empty."); } BlockInfoContiguousUnderConstruction ucBlock = lastBlock.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, locations); setBlock(numBlocks() - 1, ucBlock); return ucBlock; }
public void updateBlocksMap(INodeFile file) { // Add file->block mapping final BlockInfoContiguous[] blocks = file.getBlocks(); if (blocks != null) { final BlockManager bm = namesystem.getBlockManager(); for (int i = 0; i < blocks.length; i++) { file.setBlock(i, bm.addBlockCollection(blocks[i], file)); } } }
@Override // BlockCollection, the file should be under construction public BlockInfoContiguousUnderConstruction setLastBlock( BlockInfoContiguous lastBlock, DatanodeStorageInfo[] locations) throws IOException { Preconditions.checkState(isUnderConstruction(), "file is no longer under construction"); if (numBlocks() == 0) { throw new IOException("Failed to set last block: File is empty."); } BlockInfoContiguousUnderConstruction ucBlock = lastBlock.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, locations); setBlock(numBlocks() - 1, ucBlock); return ucBlock; }
for (Block b : newnode.getBlocks()) { BlockInfo info = namesystem.blocksMap.addINode(b, newnode); newnode.setBlock(index, info); // inode refers to the block in BlocksMap index++;
newF.setBlock(i, namesystem.blocksMap.addINode(blocks[i], newF));
newF.setBlock(i, namesystem.blocksMap.addINode(blocks[i], newF));
BlockInfo[] blocks = newF.getBlocks(); for (int i = 0; i < blocks.length; i++) { newF.setBlock(i, getFSNamesystem().blocksMap.addINode(blocks[i], newF));
newF.setBlock(i, getFSNamesystem().blocksMap.addINode(blocks[i], newF));
BlockInfoContiguous lastBlk = file.getLastBlock(); file.setBlock(file.numBlocks() - 1, new BlockInfoContiguousUnderConstruction( lastBlk, replication));
BlockInfoContiguous lastBlk = file.getLastBlock(); file.setBlock(file.numBlocks() - 1, new BlockInfoContiguousUnderConstruction( lastBlk, replication));
oldnode.setBlock(oldnode.numBlocks() - 1, info);
oldnode.setBlock(oldnode.numBlocks() - 1, info);