]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PeeringState::clamp_recovery_priority: use std::clamp
authorSamuel Just <sjust@redhat.com>
Mon, 3 Apr 2023 20:31:46 +0000 (13:31 -0700)
committerSridhar Seshasayee <sseshasa@redhat.com>
Thu, 27 Apr 2023 13:12:59 +0000 (18:42 +0530)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PeeringState.cc

index f25c86267417207f94a5083f205b38a435048484..c86fbdc6f6e58a9725d7f4d4966589fed5fb7850 100644 (file)
@@ -1000,13 +1000,7 @@ int PeeringState::clamp_recovery_priority(int priority, int pool_recovery_priori
   priority += pool_recovery_priority;
 
   // Clamp to valid range
-  if (priority > max) {
-    return max;
-  } else if (priority < OSD_RECOVERY_PRIORITY_MIN) {
-    return OSD_RECOVERY_PRIORITY_MIN;
-  } else {
-    return priority;
-  }
+  return std::clamp<int>(priority, OSD_RECOVERY_PRIORITY_MIN, max);
 }
 
 unsigned PeeringState::get_recovery_priority()