]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: switch a stage of ClientRequest to new blocking infra
authorRadosław Zarzyński <rzarzyns@redhat.com>
Tue, 5 Apr 2022 22:03:29 +0000 (00:03 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 5 May 2022 02:06:31 +0000 (04:06 +0200)
This is a debut of the new blocking & tracking infrastructure
using the type-aware `BlockerT::BlockingEvent::Trigger<T>`.

Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/crimson/common/operation.h
src/crimson/osd/osd_operation.h
src/crimson/osd/osd_operations/client_request.cc
src/crimson/osd/osd_operations/client_request.h

index 4fcfcbd8127636e2c6b80ad15435241a96336ad6..31ed35ad59fc837600e5f52d1fe4c1a2b911a474 100644 (file)
@@ -532,6 +532,21 @@ public:
     );
   }
 
+  template <typename OpT, typename T>
+  seastar::future<>
+  enter(T &stage, typename T::BlockingEvent::template Trigger<OpT>&& 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.
    */
index 07baf3b961dffc5560ac187f0ff2abc75c1d8d6c..8a0ee05856df6f806132104f14488d0154c011d4 100644 (file)
@@ -154,6 +154,13 @@ protected:
     // dispatch (backend, blocker type)
     get_event<EventT>().trigger(*that(), std::forward<Args>(args)...);
   }
+
+  template <class BlockingEventT, class F>
+  auto with_blocking_event(F&& f) {
+    return std::forward<F>(f)(typename BlockingEventT::template Trigger<T>{
+      get_event<BlockingEventT>(), *that()
+    });
+  }
 };
 
 template <class T>
@@ -162,6 +169,14 @@ class PhasedOperationT : public TrackableOperationT<T> {
 protected:
   using TrackableOperationT<T>::TrackableOperationT;
 
+  template <class StageT>
+  auto enter_stage(StageT& stage) {
+    return this->template with_blocking_event<typename StageT::BlockingEvent>(
+      [&stage, this] (auto&& trigger) {
+      return handle.enter<T>(stage, std::move(trigger));
+    });
+  }
+
   PipelineHandle handle;
 };
 
index 8eee02a6932a4a0203aae2f0746099cbeabad44b..fd6c20a3b4ac067a52a4f5194269c0e586a2ae93 100644 (file)
@@ -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()));
index 462b12a29faed811e741e78d0b3ac64024e8b515..c37fc2e64142fd0eda086e4db2157095ac31b11b 100644 (file)
@@ -100,6 +100,11 @@ private:
       Errorator>;
 
   bool is_misdirected(const PG& pg) const;
+
+public:
+  std::tuple<
+    ConnectionPipeline::AwaitMap::BlockingEvent
+  > tracking_events;
 };
 
 }