From: Ronen Friedman Date: Thu, 2 Feb 2023 15:06:46 +0000 (+0200) Subject: osd/scrub: remove PgScrubber::unregister_from_osd() X-Git-Tag: v19.0.0~1389^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c37d45f434d1f7cda959b4dbdbe6fcd5aa7b6831;p=ceph.git osd/scrub: remove PgScrubber::unregister_from_osd() and inline its functionality into its sole caller (PgScrubber::rm_from_osd_scrubbing()) Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/osd_scrub_sched.h b/src/osd/scrubber/osd_scrub_sched.h index ac9dab728dca..b00654153205 100644 --- a/src/osd/scrubber/osd_scrub_sched.h +++ b/src/osd/scrubber/osd_scrub_sched.h @@ -275,6 +275,12 @@ class ScrubQueue { : "not-queued"; } + /** + * access the 'state' directly, for when a distinction between 'registered' + * and 'unregistering' is needed (both have in_queues() == true) + */ + bool is_state_registered() const { return state == qu_state_t::registered; } + /** * a text description of the "scheduling intentions" of this PG: * are we already scheduled for a scrub/deep scrub? when? diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 806e5d8a84d5..3be30bf715bd 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -464,13 +464,6 @@ unsigned int PgScrubber::scrub_requeue_priority( // ///////////////////////////////////////////////////////////////////// // // scrub-op registration handling -void PgScrubber::unregister_from_osd() -{ - if (m_scrub_job) { - dout(15) << __func__ << " prev. state: " << registration_state() << dendl; - m_osds->get_scrub_services().remove_from_osd_queue(m_scrub_job); - } -} bool PgScrubber::is_scrub_registered() const { @@ -487,8 +480,12 @@ std::string_view PgScrubber::registration_state() const void PgScrubber::rm_from_osd_scrubbing() { - // make sure the OSD won't try to scrub this one just now - unregister_from_osd(); + if (m_scrub_job && m_scrub_job->is_state_registered()) { + dout(15) << fmt::format( + "{}: prev. state: {}", __func__, registration_state()) + << dendl; + m_osds->get_scrub_services().remove_from_osd_queue(m_scrub_job); + } } void PgScrubber::on_primary_change( diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index bad3f00964f5..a48f78d93a3e 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -887,8 +887,6 @@ class PgScrubber : public ScrubPgIF, */ void request_rescrubbing(requested_scrub_t& req_flags); - void unregister_from_osd(); - /* * Select a range of objects to scrub. *