code: Block addBlock(String path, INode[] inodes, Block block) throws IOException {
      waitForReady();
  
      writeLock();
      try {
        INodeFile fileNode = (INodeFile) inodes[inodes.length-1];
        INode.enforceRegularStorageINode(fileNode, 
            "addBlock only works for regular file, not " + path);
        
        // 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.getReplication());
        fileNode.getStorage().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;
    }
docs: Add a block to the file. Returns a reference to the added block.