if (setStoredBlock) { when(b1.getINode()).thenReturn(iNFmock); fsn.blockManager.blocksMap.addINode(b1, iNFmock);
/** * Add a block to the file. Returns a reference to the added block. */ Block addBlock(String path, INode[] inodes, Block block) throws IOException { waitForReady(); synchronized (rootDir) { INodeFile fileNode = (INodeFile) inodes[inodes.length-1]; // check quota limits and updated space consumed updateCount(inodes, inodes.length-1, 0, fileNode.getPreferredBlockSize()*fileNode.getReplication()); // associate the new list of blocks with this file namesystem.blocksMap.addINode(block, fileNode); BlockInfo blockInfo = namesystem.blocksMap.getStoredBlock(block); fileNode.addBlock(blockInfo); NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: " + path + " with " + block + " block is added to the in-memory " + "file system"); } return block; }
/** * Add a block to the file. Returns a reference to the added block. */ Block addBlock(String path, INode[] inodes, Block block) throws IOException { waitForReady(); writeLock(); try { INodeFile fileNode = (INodeFile) inodes[inodes.length-1]; // check quota limits and updated space consumed updateCount(inodes, inodes.length-1, 0, fileNode.getPreferredBlockSize()*fileNode.getReplication(), true); // associate the new list of blocks with this file BlockInfo blockInfo = getFSNamesystem().blocksMap.addINode(block, fileNode); fileNode.addBlock(blockInfo); if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: " + path + " with " + block + " block is added to the in-memory " + "file system"); } } finally { writeUnlock(); } return block; }
BlockInfo info = namesystem.blocksMap.addINode(b, newnode);
newF.setBlock(i, namesystem.blocksMap.addINode(blocks[i], newF));
newF.setBlock(i, namesystem.blocksMap.addINode(blocks[i], newF));
final BlockInfo newblockinfo = blocksMap.addINode(lastblock, pendingFile);
final BlockInfo newblockinfo = blocksMap.addINode(lastblock, pendingFile);
BlockInfo[] blocks = newF.getBlocks(); for (int i = 0; i < blocks.length; i++) { newF.setBlock(i, getFSNamesystem().blocksMap.addINode(blocks[i], newF));
BlockInfo info = getFSNamesystem().blocksMap.addINode(b, newnode);
newF.setBlock(i, getFSNamesystem().blocksMap.addINode(blocks[i], newF));