From 744386bf71485a8c5c283498980c8e48d5f73e01 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Wed, 24 Apr 2024 10:39:05 +0800 Subject: [PATCH] crimson/common/operation.h: move functionality of OrderedConcurrentPhaseT::BlockingEvent into BlockerT This makes compliers' instantiation of crimson::BlockerT::BlockingEvent complete when instantiating crimson::BlockerT Signed-off-by: Xuehan Xu (cherry picked from commit 01aa611e71a5ac8affaeaed2a2211c6bdc0d76ce) --- src/crimson/common/operation.h | 40 +++++++++++++--------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 82d0d548442..74445cad0b7 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -140,14 +140,17 @@ public: struct BlockingEvent : Event { using Blocker = std::decay_t; + struct ExitBarrierEvent : TimeEvent { + } exit_barrier_event; + struct Backend { // `T` is based solely to let implementations to discriminate // basing on the type-of-event. - virtual void handle(typename T::BlockingEvent&, const Operation&, const T&) = 0; + virtual void handle(BlockingEvent&, const Operation&, const T&) = 0; }; struct InternalBackend : Backend { - void handle(typename T::BlockingEvent&, + void handle(BlockingEvent&, const Operation&, const T& blocker) override { this->timestamp = ceph_clock_now(); @@ -213,12 +216,21 @@ public: const OpT &get_op() { return op; } + template + decltype(auto) maybe_record_exit_barrier(FutureT&& fut) { + if (!fut.available()) { + this->event.exit_barrier_event.trigger(this->op); + } + return std::forward(fut); + } + protected: void record_blocking(const T& blocker) override { this->event.trigger(op, blocker); } const OpT& op; + }; void dump(ceph::Formatter *f) const { @@ -228,6 +240,7 @@ public: internal_backend.timestamp, internal_backend.blocker, f); + exit_barrier_event.dump(f); } }; @@ -645,29 +658,6 @@ private: */ template class OrderedConcurrentPhaseT : public PipelineStageIT { - using base_t = PipelineStageIT; -public: - struct BlockingEvent : base_t::BlockingEvent { - using base_t::BlockingEvent::BlockingEvent; - - struct ExitBarrierEvent : TimeEvent {}; - - template - struct Trigger : base_t::BlockingEvent::template Trigger { - using base_t::BlockingEvent::template Trigger::Trigger; - - template - decltype(auto) maybe_record_exit_barrier(FutureT&& fut) { - if (!fut.available()) { - exit_barrier_event.trigger(this->op); - } - return std::forward(fut); - } - - ExitBarrierEvent exit_barrier_event; - }; - }; - private: void dump_detail(ceph::Formatter *f) const final {} -- 2.39.5