From 22bb6d9ed558ded532c1604d311b8a3f128b047b Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 5 Sep 2024 01:06:36 -0500 Subject: [PATCH] osd/scrub: remove flags_to_shallow_priority() As part of the removal of the 'planned scrub' flags (initiated in the previous PRs): flags_to..() is called from PgScrubber::update_targets(), and checks for two special cases before calling adjust_shallow_schedule(): 1) if the scrub is mandatory due to stats_invalid: the code to handle this case is moved to PgScrubber::update_targets(). 2) if the scrub is mandatory due to operator request: this is already handled by operator_forced_targets(). Signed-off-by: Ronen Friedman --- src/osd/PG.cc | 6 ------ src/osd/PG.h | 2 -- src/osd/scrubber/pg_scrubber.cc | 29 ++++++----------------------- src/osd/scrubber/pg_scrubber.h | 8 -------- 4 files changed, 6 insertions(+), 39 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f7a5033574f..718d7d309ba 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1279,12 +1279,6 @@ void PG::requeue_map_waiters() } } -bool PG::get_must_scrub() const -{ - dout(20) << __func__ << " must_scrub? " << (m_planned_scrub.must_scrub ? "true" : "false") << dendl; - return m_planned_scrub.must_scrub; -} - unsigned int PG::scrub_requeue_priority(Scrub::scrub_prio_t with_priority) const { return m_scrubber->scrub_requeue_priority(with_priority); diff --git a/src/osd/PG.h b/src/osd/PG.h index 6bcb77ee5a9..4947dcd27de 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -685,8 +685,6 @@ public: void shutdown(); virtual void on_shutdown() = 0; - bool get_must_scrub() const; - Scrub::schedule_result_t start_scrubbing( const Scrub::SchedEntry& candidate, Scrub::OSDRestrictions osd_restrictions); diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index b0bdc9fcb95..97cdf49631a 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -508,26 +508,6 @@ bool PgScrubber::flags_to_deep_priority( } -void PgScrubber::flags_to_shallow_priority( - const Scrub::sched_conf_t& app_conf, - utime_t scrub_clock_now) -{ - auto& entry = m_scrub_job->shallow_target.sched_info_ref(); - - if (m_planned_scrub.must_scrub) { - - // Set the smallest time that isn't utime_t() - entry.schedule.scheduled_at = PgScrubber::scrub_must_stamp(); - ///\todo missing a distinct urgency level for 'must' scrubs - entry.urgency = urgency_t::operator_requested; - - } else if (m_pg->info.stats.stats_invalid && app_conf.mandatory_on_invalid) { - entry.schedule.scheduled_at = scrub_clock_now; - entry.urgency = urgency_t::operator_requested; - } -} - - void PgScrubber::update_targets( const requested_scrub_t& planned, utime_t scrub_clock_now) @@ -543,9 +523,12 @@ void PgScrubber::update_targets( // first, use the planned-scrub flags to possibly set one of the // targets as high-priority. // Note - this step is to be removed in the followup commits. - auto deep_hp_set = flags_to_deep_priority(applicable_conf, scrub_clock_now); - if (!deep_hp_set) { - flags_to_shallow_priority(populate_config_params(), scrub_clock_now); + flags_to_deep_priority(applicable_conf, scrub_clock_now); + + if (m_pg->info.stats.stats_invalid && applicable_conf.mandatory_on_invalid) { + m_scrub_job->shallow_target.sched_info_ref().schedule.scheduled_at = + scrub_clock_now; + m_scrub_job->shallow_target.up_urgency_to(urgency_t::must_scrub); } // the next periodic scrubs: diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index d751081566e..95da64825ec 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -875,14 +875,6 @@ class PgScrubber : public ScrubPgIF, const Scrub::sched_conf_t& app_conf, utime_t scrub_clock_now); - /** - * use the 'planned scrub' flags to determine the urgency attribute - * of the 'shallow target' part of the ScrubJob object. - */ - void flags_to_shallow_priority( - const Scrub::sched_conf_t& app_conf, - utime_t scrub_clock_now); - /** * recompute the two ScrubJob targets, taking into account not * only the up-to-date 'last' stamps, but also the 'planned scrub' -- 2.39.5