code: private FSVolume findVolumeForHardLink(String srcFileSystem,
        int srcNamespaceId, Block srcBlock, File srcBlockFile)
      throws IOException {
      FSVolume dstVol = null;
      if (srcBlockFile == null || !srcBlockFile.exists()) {
        throw new IOException("File " + srcBlockFile
            + " is not valid or does not have"
            + " a valid block file");
      }
  
      // The source file might not necessarily be a part of the FSVolumeSet of
      // this datanode, it could be part of a FSVolumeSet of another datanode on
      // the same host.
      DatanodeBlockInfo blockInfo = volumeMap.get(srcNamespaceId, srcBlock);
      if (blockInfo != null) {
        dstVol = blockInfo.getBlockDataFile().getVolume();
      } else {
        for(FSVolume volume : volumes.getVolumes()) {
          String volFileSystem = volume.getFileSystem();
          if (volFileSystem.equals(srcFileSystem)) {
            dstVol = volume;
            break;
          }
        }
      }
      return dstVol;
    }
docs: Find a volume on the datanode for the destination block to be placed on.
  It tries to place the destination block on the same volume as the source
  block since hardlinks can be performed only between two files on the same
  disk
  
  @param srcFileSystem
  the file system for srcBlockFile
  @param srcNamespaceId
  the namespace id for srcBlock
  @param srcBlock
  the source block which needs to be hardlinked
  @param srcBlockFile
  the block file for srcBlock
  @return the FSVolume on which we should put the dstBlock, null if we can't
  find such a volume.
  @throws IOException