code: private StorageDirView getCandidateDirInTier(StorageTierView tierView, long blockSize) {
      StorageDirView candidateDirView = null;
      long maxFreeBytes = blockSize - 1;
      for (StorageDirView dirView : tierView.getDirViews()) {
        if (dirView.getAvailableBytes() > maxFreeBytes) {
          maxFreeBytes = dirView.getAvailableBytes();
          candidateDirView = dirView;
        }
      }
      return candidateDirView;
    }
docs: Finds a directory view in a tier view that has max free space and is able to store the block.
  
  @param tierView the storage tier view
  @param blockSize the size of block in bytes
  @return the storage directory view if found, null otherwise