From: Ronen Friedman Date: Mon, 24 Jan 2022 13:01:49 +0000 (+0000) Subject: osd/scrub: fix clang compilation issues X-Git-Tag: v18.0.0~1506^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44755%2Fhead;p=ceph.git osd/scrub: fix clang compilation issues Issues created by the scrub-backend refactoring PR. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 14f6a67e5201..af1876badfad 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 313ab7be5cbf..4263e24603eb 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 2fed0a399f16..942d5271e8c9 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;