From d57bf59968e40e47cab3e11684b2f76dbc4d43c6 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 13 Feb 2023 21:30:58 -0800 Subject: [PATCH] osd/scrubber: add whoami, cct, clog to ScrubMachineListener Signed-off-by: Samuel Just (cherry picked from commit 61ee26df552706919f0981f8918a0b66b9735520) --- src/osd/scrubber/pg_scrubber.cc | 10 ++++++++++ src/osd/scrubber/pg_scrubber.h | 5 +++++ src/osd/scrubber/scrub_machine_lstnr.h | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index dbfbce7c3426..1c27cc15e1cf 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -683,6 +683,16 @@ void PgScrubber::cancel_callback(scrubber_callback_cancel_token_t token) m_osds->sleep_timer.cancel_event(token); } +LogChannelRef &PgScrubber::get_clog() const +{ + return m_osds->clog; +} + +int PgScrubber::get_whoami() const +{ + return m_osds->whoami; +} + /* * The selected range is set directly into 'm_start' and 'm_end' * setting: diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index a3d25fd34390..47295969d581 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -498,6 +498,11 @@ class PgScrubber : public ScrubPgIF, // the I/F used by the state-machine (i.e. the implementation of // ScrubMachineListener) + CephContext* get_cct() const final { return m_pg->cct; } + LogChannelRef &get_clog() const final; + int get_whoami() const final; + spg_t get_spgid() const final { return m_pg->get_pgid(); } + scrubber_callback_cancel_token_t schedule_callback_after( ceph::timespan duration, scrubber_callback_t &&cb); diff --git a/src/osd/scrubber/scrub_machine_lstnr.h b/src/osd/scrubber/scrub_machine_lstnr.h index 542d9f52b6f4..ff0f2fd36ba7 100644 --- a/src/osd/scrubber/scrub_machine_lstnr.h +++ b/src/osd/scrubber/scrub_machine_lstnr.h @@ -72,6 +72,11 @@ using BlockedRangeWarning = std::unique_ptr; } // namespace Scrub struct ScrubMachineListener { + virtual CephContext *get_cct() const = 0; + virtual LogChannelRef &get_clog() const = 0; + virtual int get_whoami() const = 0; + virtual spg_t get_spgid() const = 0; + using scrubber_callback_t = std::function; using scrubber_callback_cancel_token_t = Context*; -- 2.47.3