From 8aa48dc64ad87da631659f35120bd5c9df57edf4 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 15 Aug 2024 08:17:48 -0500 Subject: [PATCH] osd/scrub: reverse OSDRestrictions flags polarity 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 --- src/osd/scrubber/osd_scrub.cc | 11 ++++++----- src/osd/scrubber_common.h | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/osd/scrubber/osd_scrub.cc b/src/osd/scrubber/osd_scrub.cc index 1708fc26b4422..f905c9da8dbb9 100644 --- a/src/osd/scrubber/osd_scrub.cc +++ b/src/osd/scrubber/osd_scrub.cc @@ -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; diff --git a/src/osd/scrubber_common.h b/src/osd/scrubber_common.h index 5d6fe2902146a..51d5d5e5641b4 100644 --- a/src/osd/scrubber_common.h +++ b/src/osd/scrubber_common.h @@ -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 { 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" : ""); } -- 2.39.5