code: private static int setMapCount(long fileCount, long totalBytes, 
                    JobConf job, JobClient client)
        throws IOException {
      int numMaps = Math.max(
        (int)(totalBytes / job.getLong(BYTES_PER_MAP_LABEL, BYTES_PER_MAP)), 
        (int)(fileCount / job.getInt(MAX_FILES_PER_MAPPER_LABEL, 
                                      MAX_FILES_PER_MAPPER_DEFAULT)));
          
      int numTasks = MAX_MAPS_DEFAULT;
      try {
        numTasks = client.getClusterStatus().getTaskTrackers();
      } catch (UnsupportedOperationException uex) {
        // This is corona client that does not support the getClusterStatus()
      }
  
      numMaps = Math.min(numMaps, 
          job.getInt(MAX_MAPS_LABEL, MAX_MAPS_PER_NODE * numTasks));
      job.setNumMapTasks(Math.max(numMaps, 1));
      return Math.max(numMaps, 1);
    }
docs: Calculate how many maps to run.
  Number of maps is bounded by a minimum of the cumulative size of the
  copy / (distcp.bytes.per.map, default BYTES_PER_MAP or -m on the
  command line) and at most (distcp.max.map.tasks, default
  MAX_MAPS_PER_NODE * nodes in the cluster).
  @param fileCount  Count of total files for job.
  @param totalBytes Count of total bytes for job
  @param job The job to configure
  @param client JobClient object to access the cluster
  @return Count of maps to run.