From af17ae808fd641533c1f8a1951754320aa4ac7bc Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sun, 28 Jul 2024 05:20:38 -0500 Subject: [PATCH] osd/scrub: fix reserve_local() to use the correct method when determining whether we should perform the reservation. Signed-off-by: Ronen Friedman --- src/osd/scrubber/pg_scrubber.cc | 13 +++---------- src/osd/scrubber/pg_scrubber.h | 2 +- src/osd/scrubber_common.h | 15 +++++---------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index f31954df3ebb7..c29b560a2f650 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -723,16 +723,9 @@ void PgScrubber::request_rescrubbing(requested_scrub_t& request_flags) * a wrapper around the actual reservation, and that object releases * the local resource automatically when reset. */ -bool PgScrubber::reserve_local() -{ - // Implementation note re the 'is high priority' parameter: - // In this step in the scrub scheduling rework, at the point of the call to - // this function, set_op_params() was not yet called, and we cannot rely - // on m_is_deep to determine the scrub level. So for now - we check both - // targets here. - const bool is_hp = - m_scrub_job->is_job_high_priority(scrub_level_t::shallow) || - m_scrub_job->is_job_high_priority(scrub_level_t::deep); +bool PgScrubber::reserve_local(const Scrub::SchedTarget& trgt) +{ + const bool is_hp = !ScrubJob::observes_max_concurrency(trgt.urgency()); m_local_osd_resource = m_osds->get_scrub_services().inc_scrubs_local(is_hp); if (m_local_osd_resource) { diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index f2ce4c3000ed5..072b623edafd6 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -273,7 +273,7 @@ class PgScrubber : public ScrubPgIF, * Fails if OSD's local-scrubs budget was exhausted * \returns were local resources reserved? */ - bool reserve_local() final; + bool reserve_local(const Scrub::SchedTarget& trgt); void handle_query_state(ceph::Formatter* f) final; diff --git a/src/osd/scrubber_common.h b/src/osd/scrubber_common.h index 7c6c9239730eb..60cb19a9af2d9 100644 --- a/src/osd/scrubber_common.h +++ b/src/osd/scrubber_common.h @@ -89,6 +89,8 @@ struct OSDRestrictions { bool only_deadlined{false}; bool load_is_low:1{true}; bool time_permit:1{true}; + bool max_concurrency_reached:1{false}; + bool recovery_in_progress:1{false}; }; static_assert(sizeof(Scrub::OSDRestrictions) <= sizeof(uint32_t)); @@ -592,16 +594,6 @@ struct ScrubPgIF { virtual void update_scrub_stats( ceph::coarse_real_clock::time_point now_is) = 0; - // --------------- reservations ----------------------------------- - - /** - * Reserve local scrub resources (managed by the OSD) - * - * Fails if OSD's local-scrubs budget was exhausted - * \returns were local resources reserved? - */ - virtual bool reserve_local() = 0; - /** * Recalculate scrub (both deep & shallow) schedules * @@ -609,6 +601,9 @@ struct ScrubPgIF { */ virtual void update_scrub_job(Scrub::delay_ready_t delay_ready) = 0; + + // --------------- reservations ----------------------------------- + /** * route incoming replica-reservations requests/responses to the * appropriate handler. -- 2.39.5