From 2c1585c62522e5a86ff2ea32f91ed832f8116456 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Thu, 28 Apr 2022 12:02:28 +0200 Subject: [PATCH] crimson/osd: drop the old blocking infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Radosław Zarzyński --- src/crimson/common/operation.cc | 21 ---- src/crimson/common/operation.h | 179 -------------------------------- 2 files changed, 200 deletions(-) diff --git a/src/crimson/common/operation.cc b/src/crimson/common/operation.cc index 93fc681cb4077..4532ab7cec7ec 100644 --- a/src/crimson/common/operation.cc +++ b/src/crimson/common/operation.cc @@ -16,16 +16,6 @@ void Operation::dump(ceph::Formatter* f) const dump_detail(f); f->close_section(); } -#if 0 - // TODO: implement when necessary at the leaf class layer - // as that's the place that will be aware about the exact - // type of an event container. - f->open_array_section("blockers"); - for (auto &blocker : blockers) { - blocker->dump(f); - } - f->close_section(); -#endif f->close_section(); } @@ -56,17 +46,6 @@ void Blocker::dump(ceph::Formatter* f) const f->close_section(); } -void AggregateBlocker::dump_detail(ceph::Formatter *f) const -{ - f->open_array_section("parent_blockers"); - for (auto b : parent_blockers) { - f->open_object_section("parent_blocker"); - b->dump(f); - f->close_section(); - } - f->close_section(); -} - namespace detail { void dump_time_event(const char* name, const utime_t& timestamp, diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index d55da04b67742..4daa14ede780f 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -33,95 +33,6 @@ using registry_hook_t = boost::intrusive::list_member_hook< class Operation; class Blocker; -/** - * Provides an abstraction for registering and unregistering a blocker - * for the duration of a future becoming available. - */ -template -class blocking_future_detail { -// just as a scaffolding for the transition from blocking_future -public: - friend class Blocker; - Blocker *blocker; - Fut fut; - blocking_future_detail(Blocker *b, Fut &&f) - : blocker(b), fut(std::move(f)) {} - - template - friend blocking_future_detail> - make_ready_blocking_future(U&&... args); - - template - friend blocking_future_detail> - make_exception_blocking_future(Exception&& e); - - template - friend blocking_future_detail> join_blocking_futures(U &&u); - - template - friend blocking_future_detail< - ::crimson::interruptible::interruptible_future> - join_blocking_interruptible_futures(T&& t); - - template - friend class blocking_future_detail; - -public: - template - auto then(F &&f) && { - using result = decltype(std::declval().then(f)); - return blocking_future_detail>( - blocker, - std::move(fut).then(std::forward(f))); - } - template - auto then_interruptible(F &&f) && { - using result = decltype(std::declval().then_interruptible(f)); - return blocking_future_detail< - typename ::crimson::interruptible::interruptor< - InterruptCond>::template futurize::type>( - blocker, - std::move(fut).then_interruptible(std::forward(f))); - } -}; - -template -using blocking_future = blocking_future_detail>; - -template -using blocking_interruptible_future = blocking_future_detail< - ::crimson::interruptible::interruptible_future>; - -template -blocking_interruptible_future -make_ready_blocking_interruptible_future(U&& args) { - return blocking_interruptible_future( - nullptr, - seastar::make_ready_future(std::forward(args))); -} - -template -blocking_interruptible_future -make_exception_blocking_interruptible_future(Exception&& e) { - return blocking_interruptible_future( - nullptr, - seastar::make_exception_future(e)); -} - -template -blocking_future_detail> make_ready_blocking_future(U&&... args) { - return blocking_future( - nullptr, - seastar::make_ready_future(std::forward(args)...)); -} - -template -blocking_future_detail> -make_exception_blocking_future(Exception&& e) { - return blocking_future( - nullptr, - seastar::make_exception_future(e)); -} namespace detail { void dump_time_event(const char* name, @@ -139,27 +50,6 @@ void dump_blocking_event(const char* name, */ class Blocker { public: - template - blocking_future make_blocking_future(seastar::future &&f) { - return blocking_future(this, std::move(f)); - } - - template - blocking_interruptible_future - make_blocking_future( - crimson::interruptible::interruptible_future &&f) { - return blocking_interruptible_future( - this, std::move(f)); - } - template - blocking_interruptible_future - make_blocking_interruptible_future(seastar::future &&f) { - return blocking_interruptible_future( - this, - ::crimson::interruptible::interruptor::make_interruptible( - std::move(f))); - } - void dump(ceph::Formatter *f) const; virtual ~Blocker() = default; @@ -377,56 +267,6 @@ private: friend class Trigger; }; -class AggregateBlocker : public BlockerT { - std::vector parent_blockers; -public: - AggregateBlocker(std::vector &&parent_blockers) - : parent_blockers(std::move(parent_blockers)) {} - static constexpr const char *type_name = "AggregateBlocker"; -private: - void dump_detail(ceph::Formatter *f) const final; -}; - -template -blocking_future<> join_blocking_futures(T &&t) { - std::vector blockers; - blockers.reserve(t.size()); - for (auto &&bf: t) { - blockers.push_back(bf.blocker); - bf.blocker = nullptr; - } - auto agg = std::make_unique(std::move(blockers)); - return agg->make_blocking_future( - seastar::parallel_for_each( - std::forward(t), - [](auto &&bf) { - return std::move(bf.fut); - }).then([agg=std::move(agg)] { - return seastar::make_ready_future<>(); - })); -} - -template -blocking_interruptible_future -join_blocking_interruptible_futures(T&& t) { - std::vector blockers; - blockers.reserve(t.size()); - for (auto &&bf: t) { - blockers.push_back(bf.blocker); - bf.blocker = nullptr; - } - auto agg = std::make_unique(std::move(blockers)); - return agg->make_blocking_future( - ::crimson::interruptible::interruptor::parallel_for_each( - std::forward(t), - [](auto &&bf) { - return std::move(bf.fut); - }).then_interruptible([agg=std::move(agg)] { - return seastar::make_ready_future<>(); - })); -} - - /** * Common base for all crimson-osd operations. Mainly provides * an interface for registering ops in flight and dumping @@ -592,25 +432,6 @@ public: * that phase after placing itself in the queue for the next one to preserve * ordering. */ - template - blocking_future<> enter(T &t) { - /* Strictly speaking, we probably want the blocker to be registered on - * the previous stage until wait_barrier() resolves and on the next - * until enter() resolves, but blocking_future will need some refactoring - * to permit that. TODO - */ - return t.make_blocking_future( - wait_barrier().then([this, &t] { - auto fut = t.enter(); - exit(); - return std::move(fut).then([this](auto &&barrier_ref) { - barrier = std::move(barrier_ref); - return seastar::now(); - }); - }) - ); - } - template seastar::future<> enter(T &stage, typename T::BlockingEvent::template Trigger&& t) { -- 2.39.5