code: BlockInfo isReplicationInProgress(final DecommissioningStatus status,
        final DatanodeDescriptor srcNode, final BlockInfo block,
        boolean addToNeeded) {
      INode fileINode = blocksMap.getINode(block);
      if (fileINode == null) {
        return null;
      }
      NumberReplicas num = countNodes(block);
      int curReplicas = num.liveReplicas();
      int curExpectedReplicas = getReplication(block);
      if (curExpectedReplicas > curReplicas) {
        if (status!= null) {
          //Log info about one block for this node which needs replication
          if (status.underReplicatedBlocks == 0) {
            logBlockReplicationInfo(block, srcNode, num);
          }
          status.underReplicatedBlocks++;
          if ((curReplicas == 0) && (num.decommissionedReplicas() > 0)) {
            status.decommissionOnlyReplicas++;
          }
          if (fileINode.isUnderConstruction()) {
            status.underReplicatedInOpenFiles++;
          }
        }
        if (!neededReplications.contains(block) &&
          pendingReplications.getNumReplicas(block) == 0) {
          //
          // These blocks have been reported from the datanode
          // after the startDecommission method has been executed. These
          // blocks were in flight when the decommissioning was started.
          //
          if (addToNeeded) {
            neededReplications.add(block, 
                curReplicas,
                num.decommissionedReplicas(),
                curExpectedReplicas);
          } else {
            return block;
          }
        }
      }
      return null;
    }
docs: Check if a block on srcNode has reached its replication factor or not
  
  @param status decomission status to update; null means no update
  @param srcNode a datanode
  @param block   a block
  @param addToNeeded if the block needs to add to needReplication queue
  @return block if not addToNeeded and the block needes to added later