From 1a44046339e781c99a1a7207fbf2fccd89266e3d Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 16 Jun 2021 17:46:06 +0800 Subject: [PATCH] crimson/osd: extract with_sequencer() method out because we should only ensure the ordering of the requests touching the objects, the other requests like pgls should not be ordered along with them, so as the first step, let's extract with_sequencer() method out, so we can differentiate these two cases with minimal repeatings. Signed-off-by: Kefu Chai --- src/crimson/osd/osd_operations/client_request.cc | 11 +++-------- src/crimson/osd/osd_operations/client_request.h | 8 ++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 90f52a7306d..b52c4928837 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -87,12 +87,8 @@ seastar::future<> ClientRequest::start() return interruptor::with_interruption([this, pgref]() mutable { epoch_t same_interval_since = pgref->get_interval_start_epoch(); logger().debug("{} same_interval_since: {}", *this, same_interval_since); - may_set_prev_op(); - return sequencer.start_op( - *this, - handle, - interruptor::wrap_function( - [this, pgref]() mutable -> interruptible_future<> { + return with_sequencer( + interruptor::wrap_function([this, pgref]() -> interruptible_future<> { PG &pg = *pgref; if (pg.can_discard_op(*m)) { return osd.send_incremental_map(conn, m->get_map_epoch()); @@ -119,8 +115,7 @@ seastar::future<> ClientRequest::start() } }); }) - ).then_interruptible([this, pgref]() { - sequencer.finish_op(*this); + ).then_interruptible([pgref]() { return seastar::stop_iteration::yes; }); }, [this, pgref](std::exception_ptr eptr) { diff --git a/src/crimson/osd/osd_operations/client_request.h b/src/crimson/osd/osd_operations/client_request.h index 5e40d6684bc..05a75515c4d 100644 --- a/src/crimson/osd/osd_operations/client_request.h +++ b/src/crimson/osd/osd_operations/client_request.h @@ -63,6 +63,14 @@ public: } private: + template + interruptible_future<> with_sequencer(FuncT&& func) { + may_set_prev_op(); + return sequencer.start_op(*this, handle, std::forward(func)) + .then_interruptible([this] { + sequencer.finish_op(*this); + }); + } interruptible_future<> do_process( Ref& pg, crimson::osd::ObjectContextRef obc); -- 2.39.5