code: private NumberReplicas countNodes(Block b,
                                      Iterator<DatanodeDescriptor> nodeIter) {
      int count = 0;
      int live = 0;
      int corrupt = 0;
      int excess = 0;
      Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
      while (nodeIter.hasNext()) {
        DatanodeDescriptor node = nodeIter.next();
        if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) {
          corrupt++;
        } else if (node.isDecommissionInProgress() || node.isDecommissioned()) {
          count++;
        } else {
          Collection<Block> blocksExcess = initializedReplQueues ?
            excessReplicateMap.get(node.getStorageID()) : null;
          if (blocksExcess != null && blocksExcess.contains(b)) {
            excess++;
          } else {
            live++;
          }
        }
      }
      return new NumberReplicas(live, count, corrupt, excess);
    }
docs: Counts the number of nodes in the given list into active and
  decommissioned counters.