From 3e99e526c0c15a6530e62b01df92c4f59016b171 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Wed, 6 Apr 2022 00:03:29 +0200 Subject: [PATCH] crimson/osd: switch a stage of ClientRequest to new blocking infra MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a debut of the new blocking & tracking infrastructure using the type-aware `BlockerT::BlockingEvent::Trigger`. Signed-off-by: Radosław Zarzyński --- src/crimson/common/operation.h | 15 +++++++++++++++ src/crimson/osd/osd_operation.h | 15 +++++++++++++++ src/crimson/osd/osd_operations/client_request.cc | 3 +-- src/crimson/osd/osd_operations/client_request.h | 5 +++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 4fcfcbd812763..31ed35ad59fc8 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -532,6 +532,21 @@ public: ); } + template + seastar::future<> + enter(T &stage, typename T::BlockingEvent::template Trigger&& t) { + return wait_barrier().then([this, &stage, t=std::move(t)] () mutable { + auto fut = stage.enter(); + t.maybe_record_blocking(fut, stage); + exit(); + return std::move(fut).then( + [this, t=std::move(t)](auto &&barrier_ref) mutable { + barrier = std::move(barrier_ref); + return seastar::now(); + }); + }); + } + /** * Completes pending exit barrier without entering a new one. */ diff --git a/src/crimson/osd/osd_operation.h b/src/crimson/osd/osd_operation.h index 07baf3b961dff..8a0ee05856df6 100644 --- a/src/crimson/osd/osd_operation.h +++ b/src/crimson/osd/osd_operation.h @@ -154,6 +154,13 @@ protected: // dispatch (backend, blocker type) get_event().trigger(*that(), std::forward(args)...); } + + template + auto with_blocking_event(F&& f) { + return std::forward(f)(typename BlockingEventT::template Trigger{ + get_event(), *that() + }); + } }; template @@ -162,6 +169,14 @@ class PhasedOperationT : public TrackableOperationT { protected: using TrackableOperationT::TrackableOperationT; + template + auto enter_stage(StageT& stage) { + return this->template with_blocking_event( + [&stage, this] (auto&& trigger) { + return handle.enter(stage, std::move(trigger)); + }); + } + PipelineHandle handle; }; diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 8eee02a6932a4..fd6c20a3b4ac0 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -79,8 +79,7 @@ seastar::future<> ClientRequest::start() return seastar::repeat([this, opref=IRef{this}]() mutable { logger().debug("{}: in repeat", *this); - return with_blocking_future(handle.enter(cp().await_map)) - .then([this]() { + return enter_stage(cp().await_map).then([this]() { return with_blocking_future( osd.osdmap_gate.wait_for_map( m->get_min_epoch())); diff --git a/src/crimson/osd/osd_operations/client_request.h b/src/crimson/osd/osd_operations/client_request.h index 462b12a29faed..c37fc2e64142f 100644 --- a/src/crimson/osd/osd_operations/client_request.h +++ b/src/crimson/osd/osd_operations/client_request.h @@ -100,6 +100,11 @@ private: Errorator>; bool is_misdirected(const PG& pg) const; + +public: + std::tuple< + ConnectionPipeline::AwaitMap::BlockingEvent + > tracking_events; }; } -- 2.39.5