]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: reverse OSDRestrictions flags polarity
authorRonen Friedman <rfriedma@redhat.com>
Thu, 15 Aug 2024 13:17:48 +0000 (08:17 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sun, 25 Aug 2024 13:01:00 +0000 (08:01 -0500)
As most of the flags in OSDRestrictions are of 'true is bad' polarity,
reverse the two non-conforming flags - cpu load and time-of-day
restrictions - to match.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/scrubber/osd_scrub.cc
src/osd/scrubber_common.h

index 1708fc26b442214c4391886ba42a48881a52ea3f..f905c9da8dbb9e6d18fd55cc4a68ed17f16d9da1 100644 (file)
@@ -171,10 +171,10 @@ bool OsdScrub::is_sched_target_eligible(
       ScrubJob::observes_random_backoff(e.urgency)) {
     return false;
   }
-  if (!r.time_permit && ScrubJob::observes_allowed_hours(e.urgency)) {
+  if (r.restricted_time && ScrubJob::observes_allowed_hours(e.urgency)) {
     return false;
   }
-  if (!r.load_is_low && ScrubJob::observes_load_limit(e.urgency)) {
+  if (r.cpu_overloaded && ScrubJob::observes_load_limit(e.urgency)) {
     return false;
   }
   if (r.recovery_in_progress && ScrubJob::observes_recovery(e.urgency)) {
@@ -218,10 +218,11 @@ Scrub::OSDRestrictions OsdScrub::restrictions_on_scrubbing(
   } else {
 
     // regular, i.e. non-high-priority scrubs are allowed
-    env_conditions.time_permit = scrub_time_permit(scrub_clock_now);
-    env_conditions.load_is_low = m_load_tracker.scrub_load_below_threshold();
+    env_conditions.restricted_time = !scrub_time_permit(scrub_clock_now);
+    env_conditions.cpu_overloaded =
+       !m_load_tracker.scrub_load_below_threshold();
     env_conditions.only_deadlined =
-       !env_conditions.time_permit || !env_conditions.load_is_low;
+       env_conditions.restricted_time || env_conditions.cpu_overloaded;
   }
 
   return env_conditions;
index 5d6fe2902146a8e07c8367064f48f34530401bdb..51d5d5e5641b4a2449486e2935b75e542332285b 100644 (file)
@@ -95,8 +95,9 @@ struct OSDRestrictions {
   /// the load is high, or the time is not right. For periodic scrubs,
   /// only the overdue ones are allowed.
   bool only_deadlined:1{false};
-  bool load_is_low:1{true};
-  bool time_permit:1{true};
+  bool cpu_overloaded:1{false};
+  bool restricted_time:1{false};
+
   /// the OSD is performing a recovery, osd_scrub_during_recovery is 'false',
   /// and so is osd_repair_during_recovery
   bool recovery_in_progress:1{false};
@@ -197,8 +198,8 @@ struct formatter<Scrub::OSDRestrictions> {
        ctx.out(), "<{}.{}.{}.{}.{}.{}>",
        conds.max_concurrency_reached ? "max-scrubs" : "",
        conds.random_backoff_active ? "backoff" : "",
-       conds.load_is_low ? "" : "high-load",
-       conds.time_permit ? "" : "time-restrict",
+       conds.cpu_overloaded ? "high-load" : "",
+       conds.restricted_time ? "time-restrict" : "",
        conds.recovery_in_progress ? "recovery" : "",
        conds.allow_requested_repair_only ? "repair-only" : "");
   }