]> 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>
Mon, 8 May 2023 09:16:25 +0000 (14:46 +0530)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PeeringState.cc

index 68b8d22259955dfb82455429b25b3ed8abd8fbc3..3d71e531c0852c08342812a715a9b4c4425b1873 100644 (file)
@@ -998,13 +998,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()