]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: strip blokcing_future from OperationT
authorRadosław Zarzyński <rzarzyns@redhat.com>
Wed, 27 Apr 2022 14:51:35 +0000 (16:51 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 5 May 2022 10:39:28 +0000 (12:39 +0200)
Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/crimson/osd/osd_operation.h

index 054d6e3742403e3e57806e6e42c620d999af8f8a..6fc3071f54dd0e61ce0c93b548736fb573f0bd9d 100644 (file)
@@ -56,66 +56,7 @@ struct InterruptibleOperation : Operation {
 };
 
 template <typename T>
-class OperationT : public InterruptibleOperation {
-  std::vector<Blocker*> blockers;
-
-  void add_blocker(Blocker *b) {
-    blockers.push_back(b);
-  }
-
-  void clear_blocker(Blocker *b) {
-    auto iter = std::find(blockers.begin(), blockers.end(), b);
-    if (iter != blockers.end()) {
-      blockers.erase(iter);
-    }
-  }
-
-public:
-  template <typename U>
-  seastar::future<U> with_blocking_future(blocking_future<U> &&f) {
-    if (f.fut.available()) {
-      return std::move(f.fut);
-    }
-    assert(f.blocker);
-    add_blocker(f.blocker);
-    return std::move(f.fut).then_wrapped([this, blocker=f.blocker](auto &&arg) {
-      clear_blocker(blocker);
-      return std::move(arg);
-    });
-  }
-
-  template <typename InterruptCond, typename U>
-  ::crimson::interruptible::interruptible_future<InterruptCond, U>
-  with_blocking_future_interruptible(blocking_future<U> &&f) {
-    if (f.fut.available()) {
-      return std::move(f.fut);
-    }
-    assert(f.blocker);
-    add_blocker(f.blocker);
-    auto fut = std::move(f.fut).then_wrapped([this, blocker=f.blocker](auto &&arg) {
-      clear_blocker(blocker);
-      return std::move(arg);
-    });
-    return ::crimson::interruptible::interruptible_future<
-      InterruptCond, U>(std::move(fut));
-  }
-
-  template <typename InterruptCond, typename U>
-  ::crimson::interruptible::interruptible_future<InterruptCond, U>
-  with_blocking_future_interruptible(
-    blocking_interruptible_future<InterruptCond, U> &&f) {
-    if (f.fut.available()) {
-      return std::move(f.fut);
-    }
-    assert(f.blocker);
-    add_blocker(f.blocker);
-    return std::move(f.fut).template then_wrapped_interruptible(
-      [this, blocker=f.blocker](auto &&arg) {
-      clear_blocker(blocker);
-      return std::move(arg);
-    });
-  }
-
+struct OperationT : InterruptibleOperation {
   static constexpr const char *type_name = OP_NAMES[static_cast<int>(T::type)];
   using IRef = boost::intrusive_ptr<T>;