From 013661412be3b6e7d8d41d89d7bec259e66ea7c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Tue, 26 Apr 2022 22:15:17 +0200 Subject: [PATCH] crimson: move PipelineStageIT::enter() dispatch to compile-time MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The optimization isn't the goal (but rather a side effect). The reason behind this change is to let pipeline stages define exit barriers incorporating `OpT`-dependant `Triggers` to track blocking that happens on the barriers. Signed-off-by: Radosław Zarzyński --- src/crimson/common/operation.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 6dc32007a657b..3a35af75abe4e 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -562,16 +562,13 @@ public: virtual ~PipelineExitBarrierI() {} }; -class PipelineStageI : public Blocker { -public: - virtual seastar::future enter() = 0; -}; - - template class PipelineStageIT : public BlockerT { public: - virtual seastar::future enter() = 0; + template + decltype(auto) enter(Args&&... args) { + return static_cast(this)->enter(std::forward(args)...); + } }; class PipelineHandle { @@ -689,7 +686,7 @@ class OrderedExclusivePhaseT : public PipelineStageIT { } public: - seastar::future enter() final { + seastar::future enter() { return mutex.lock().then([this] { return PipelineExitBarrierI::Ref(new ExitBarrier{this}); }); @@ -753,7 +750,7 @@ class OrderedConcurrentPhaseT : public PipelineStageIT { }; public: - seastar::future enter() final { + seastar::future enter() { return seastar::make_ready_future( new ExitBarrier{this, mutex.lock()}); } @@ -792,7 +789,7 @@ class UnorderedStageT : public PipelineStageIT { }; public: - seastar::future enter() final { + seastar::future enter() { return seastar::make_ready_future( new ExitBarrier); } -- 2.39.5