code: void decrementSafeBlockCountForBlockRemoval(Block b) {
      if (safeMode != null && safeMode.isOn()) {
        NumberReplicas num = countNodes(b);
        // Count decommissioned replicas as well since you can still read from
        // them.
        int replication = num.liveReplicas() + num.decommissionedReplicas();
        if (replication >= minReplication) {
          this.blocksSafe--;
          safeMode.checkMode();
        }
      }
    }
docs: This method is invoked just before removing a block from the
  {@link #blocksMap}. It is used to correctly update the safe block count
  when a block is removed from the {@link #blocksMap}. If the current
  replication for the block is greater than {@link #minReplication} this
  means that the safe block count has not already been decremented for this
  block and hence we should decrement the safe block count.
  
  @param b
  the block that has to be removed.