From: Yingxin Cheng Date: Thu, 25 Jan 2024 05:54:00 +0000 (+0800) Subject: crimson/common/operation: cleanup around PipelineHandle::enter() X-Git-Tag: testing/wip-jcollin-testing-20240625.102731-squid~68^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a29ad2aebe44af359449bf91f86d6c35b3d78265;p=ceph-ci.git crimson/common/operation: cleanup around PipelineHandle::enter() Signed-off-by: Yingxin Cheng (cherry picked from commit 6a538c21f071f1b22afce679351bd0264d7cfaa1) --- diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 82d0d548442..938db0c87c8 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -492,11 +492,6 @@ public: #ifndef NDEBUG const core_id_t core = seastar::this_shard_id(); #endif - - template - decltype(auto) enter(Args&&... args) { - return static_cast(this)->enter(std::forward(args)...); - } }; class PipelineHandle { @@ -506,6 +501,18 @@ class PipelineHandle { return barrier ? barrier->wait() : std::nullopt; } + template + seastar::future<> + do_enter(T &stage, typename T::BlockingEvent::template Trigger&& t) { + auto fut = t.maybe_record_blocking(stage.enter(t), stage); + return std::move(fut).then( + [this, t=std::move(t)](auto &&barrier_ref) mutable { + exit(); + barrier = std::move(barrier_ref); + return seastar::now(); + }); + } + public: PipelineHandle() = default; @@ -526,23 +533,12 @@ public: assert(stage.core == seastar::this_shard_id()); auto wait_fut = wait_barrier(); if (wait_fut.has_value()) { - return wait_fut.value().then([this, &stage, t=std::move(t)] () mutable { - auto fut = t.maybe_record_blocking(stage.enter(t), stage); - return std::move(fut).then( - [this, t=std::move(t)](auto &&barrier_ref) mutable { - exit(); - barrier = std::move(barrier_ref); - return seastar::now(); - }); + return wait_fut.value( + ).then([this, &stage, t=std::move(t)]() mutable { + return do_enter(stage, std::move(t)); }); } else { - auto fut = t.maybe_record_blocking(stage.enter(t), stage); - return std::move(fut).then( - [this, t=std::move(t)](auto &&barrier_ref) mutable { - exit(); - barrier = std::move(barrier_ref); - return seastar::now(); - }); + return do_enter(stage, std::move(t)); } }