code: public BlockInfo updateINode(BlockInfo oldBlock, Block newBlock, INodeFile iNode,
        short replication, boolean forceUpdate) throws IOException {
      // If the old block is not same as the new block, probably the GS was
      // bumped up, hence update the block with new GS/size.
      // If forceUpdate is true, we will always remove the old block and 
      // update with new block, it's used by raid
      List<DatanodeDescriptor> locations = null;
      if (oldBlock != null && (!oldBlock.equals(newBlock) || forceUpdate)) {
        if (oldBlock.getBlockId() != newBlock.getBlockId()) {
          throw new IOException("block ids don't match : " + oldBlock + ", "
              + newBlock);
        }
        if (forceUpdate) {
          // save locations of the old block
          locations = new ArrayList<DatanodeDescriptor>();
          for (int i=0; i<oldBlock.numNodes(); i++) {
            locations.add(oldBlock.getDatanode(i));
          }
        } else {
          if (!iNode.isUnderConstruction()) {
            throw new IOException(
                "Try to update generation of a finalized block old block: "
                    + oldBlock + ", new block: " + newBlock);
          }
        }
        removeBlock(oldBlock);
      }
      BlockInfo info = checkBlockInfo(newBlock, replication);
      info.set(newBlock.getBlockId(), newBlock.getNumBytes(), newBlock.getGenerationStamp());
      info.inode = iNode;
      if (locations != null) {
        // add back the locations if needed
        if (locations != null) {
          for (DatanodeDescriptor d : locations) {
            d.addBlock(info);
          }
        }
      }
      return info;
    }
docs: Add block b belonging to the specified file inode to the map, this
  overwrites the map with the new block information.