]> 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 10:52:00 +0000 (16:22 +0530)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PeeringState.cc

index 5f1a4d864839f4ac33aa192185e4f5ed3e8b16e6..62dc76cde48dea8bcddc65e4813d5a0908901337 100644 (file)
@@ -992,13 +992,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()