code: public void finalizeBlockInternal(int namespaceId, Block b, boolean reFinalizeOk)
      throws IOException {
      lock.writeLock().lock();
      DatanodeBlockInfo binfo = volumeMap.get(namespaceId, b);
      try {
        ActiveFile activeFile = volumeMap.getOngoingCreates(namespaceId, b);
        if (activeFile == null) {
          if (reFinalizeOk) {
            return;
          } else {
            throw new IOException("Block " + b + " is already finalized.");
          }
        }
        File f = activeFile.getDataFile();
        if (f == null || !f.exists()) {
          throw new IOException("No temporary file " + f + " for block " + b);
        }
        FSVolume v = binfo.getBlockDataFile().getVolume();
        if (v == null) {
          throw new IOException("No volume for temporary file " + f + 
                                " for block " + b);
        }
            
        File dest = null;
        dest = v.addBlock(namespaceId, b, f, activeFile.isInlineChecksum(),
            binfo.getChecksumType(), binfo.getBytesPerChecksum());
        volumeMap.add(
            namespaceId,
            b,
            new DatanodeBlockInfo(v, dest, activeFile.getBytesWritten(), true,
                activeFile.isInlineChecksum(), binfo.getChecksumType(),
                binfo.getBytesPerChecksum(),
                activeFile.getCrcUpdater().isCrcValid(activeFile.getBytesWritten()),
                activeFile.getCrcUpdater().getBlockCrc()));
        ActiveFile af = volumeMap.removeOngoingCreates(namespaceId, b);
        af.blockFinalize();
      } finally {
        lock.writeLock().unlock();
      }
    }
docs: Complete the block write!