From 4c86c2c858d11873c10363cbde956128783310cb Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Mon, 24 Jan 2022 13:01:49 +0000 Subject: [PATCH] osd/scrub: fix clang compilation issues Issues created by the scrub-backend refactoring PR. Signed-off-by: Ronen Friedman --- src/osd/scrubber/pg_scrubber.cc | 2 +- src/osd/scrubber/pg_scrubber.h | 13 ++++++++----- src/osd/scrubber/scrub_machine_lstnr.h | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 14f6a67e52015..af1876badfadd 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -2113,7 +2113,7 @@ PgScrubber::preemption_data_t::preemption_data_t(PG* pg) : m_pg{pg} void PgScrubber::preemption_data_t::reset() { - std::lock_guard lk{m_preemption_lock}; + std::lock_guard lk{m_preemption_lock}; m_preemptable = false; m_preempted = false; diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index 313ab7be5cbfb..4263e24603eb2 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -846,12 +846,15 @@ private: [[nodiscard]] bool is_preemptable() const final { return m_preemptable; } + preemption_data_t(const preemption_data_t&) = delete; + preemption_data_t(preemption_data_t&&) = delete; + bool do_preempt() final { if (m_preempted || !m_preemptable) return false; - std::lock_guard lk{m_preemption_lock}; + std::lock_guard lk{m_preemption_lock}; if (!m_preemptable) return false; @@ -865,7 +868,7 @@ private: void enable_preemption() { - std::lock_guard lk{m_preemption_lock}; + std::lock_guard lk{m_preemption_lock}; if (are_preemptions_left() && !m_preempted) { m_preemptable = true; } @@ -881,7 +884,7 @@ private: bool disable_and_test() final { - std::lock_guard lk{m_preemption_lock}; + std::lock_guard lk{m_preemption_lock}; m_preemptable = false; return m_preempted; } @@ -894,7 +897,7 @@ private: void adjust_parameters() final { - std::lock_guard lk{m_preemption_lock}; + std::lock_guard lk{m_preemption_lock}; if (m_preempted) { m_preempted = false; @@ -906,7 +909,7 @@ private: private: PG* m_pg; - mutable ceph::mutex m_preemption_lock; + mutable ceph::mutex m_preemption_lock = ceph::make_mutex("preemption_lock"); bool m_preemptable{false}; bool m_preempted{false}; int m_left; diff --git a/src/osd/scrubber/scrub_machine_lstnr.h b/src/osd/scrubber/scrub_machine_lstnr.h index 2fed0a399f160..942d5271e8c9b 100644 --- a/src/osd/scrubber/scrub_machine_lstnr.h +++ b/src/osd/scrubber/scrub_machine_lstnr.h @@ -20,6 +20,10 @@ struct preemption_t { virtual ~preemption_t() = default; + preemption_t() = default; + preemption_t(const preemption_t&) = delete; + preemption_t(preemption_t&&) = delete; + [[nodiscard]] virtual bool is_preemptable() const = 0; [[nodiscard]] virtual bool was_preempted() const = 0; -- 2.39.5