From: Yingxin Cheng Date: Mon, 25 Sep 2023 03:34:47 +0000 (+0800) Subject: crimson/common/operation: drop cross-core supports in ExitBarrier X-Git-Tag: v19.0.0~141^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=510cd5dc41d7d890941ad5eeca69935a3364a948;p=ceph.git crimson/common/operation: drop cross-core supports in ExitBarrier Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 3a65a793a9e1..32e617ed5aee 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -489,9 +489,10 @@ public: template class PipelineStageIT : public BlockerT { - const core_id_t core = seastar::this_shard_id(); public: - core_id_t get_core() const { return core; } +#ifndef NDEBUG + const core_id_t core = seastar::this_shard_id(); +#endif template decltype(auto) enter(Args&&... args) { @@ -523,7 +524,7 @@ public: template seastar::future<> enter(T &stage, typename T::BlockingEvent::template Trigger&& t) { - ceph_assert(stage.get_core() == seastar::this_shard_id()); + 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 { @@ -585,8 +586,8 @@ class OrderedExclusivePhaseT : public PipelineStageIT { OrderedExclusivePhaseT *phase; Operation::id_t op_id; public: - ExitBarrier(OrderedExclusivePhaseT *phase, Operation::id_t id) - : phase(phase), op_id(id) {} + ExitBarrier(OrderedExclusivePhaseT &phase, Operation::id_t id) + : phase(&phase), op_id(id) {} std::optional> wait() final { return std::nullopt; @@ -594,14 +595,9 @@ class OrderedExclusivePhaseT : public PipelineStageIT { void exit() final { if (phase) { - auto *p = phase; - auto id = op_id; - phase = nullptr; - std::ignore = seastar::smp::submit_to( - p->get_core(), - [p, id] { - p->exit(id); - }); + assert(phase->core == seastar::this_shard_id()); + phase->exit(op_id); + phase = nullptr; } } @@ -623,7 +619,7 @@ public: ceph_assert_always(waiting > 0); --waiting; set_held_by(op_id); - return PipelineExitBarrierI::Ref(new ExitBarrier{this, op_id}); + return PipelineExitBarrierI::Ref(new ExitBarrier{*this, op_id}); }); } @@ -683,9 +679,9 @@ private: TriggerT trigger; public: ExitBarrier( - OrderedConcurrentPhaseT *phase, + OrderedConcurrentPhaseT &phase, seastar::future<> &&barrier, - TriggerT& trigger) : phase(phase), barrier(std::move(barrier)), trigger(trigger) {} + TriggerT& trigger) : phase(&phase), barrier(std::move(barrier)), trigger(trigger) {} std::optional> wait() final { assert(phase); @@ -697,18 +693,18 @@ private: void exit() final { if (barrier) { - static_cast( - std::move(*barrier).then([phase=this->phase] { phase->mutex.unlock(); })); - barrier = std::nullopt; - phase = nullptr; - } - if (phase) { - std::ignore = seastar::smp::submit_to( - phase->get_core(), - [this] { - phase->mutex.unlock(); - phase = nullptr; - }); + assert(phase); + assert(phase->core == seastar::this_shard_id()); + std::ignore = std::move(*barrier + ).then([phase=this->phase] { + phase->mutex.unlock(); + }); + barrier = std::nullopt; + phase = nullptr; + } else if (phase) { + assert(phase->core == seastar::this_shard_id()); + phase->mutex.unlock(); + phase = nullptr; } } @@ -721,7 +717,7 @@ public: template seastar::future enter(TriggerT& t) { return seastar::make_ready_future( - new ExitBarrier{this, mutex.lock(), t}); + new ExitBarrier{*this, mutex.lock(), t}); } private: