From: Radosław Zarzyński Date: Tue, 5 Apr 2022 22:03:29 +0000 (+0200) Subject: crimson/osd: switch a stage of ClientRequest to new blocking infra X-Git-Tag: v18.0.0~947^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e99e526c0c15a6530e62b01df92c4f59016b171;p=ceph.git crimson/osd: switch a stage of ClientRequest to new blocking infra This is a debut of the new blocking & tracking infrastructure using the type-aware `BlockerT::BlockingEvent::Trigger`. Signed-off-by: Radosław Zarzyński --- diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 4fcfcbd81276..31ed35ad59fc 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 07baf3b961df..8a0ee05856df 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 8eee02a6932a..fd6c20a3b4ac 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 462b12a29fae..c37fc2e64142 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; }; }