From 2e50a5ed8ad387a2408f808e2bb677ebdf3a4d3f Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 25 Jan 2024 10:42:17 +0800 Subject: [PATCH] crimson/osd/osd_operations: introduce concurrent lock_obc phase Signed-off-by: Yingxin Cheng --- .../osd/osd_operation_external_tracking.h | 22 +++++++++++++++++++ .../osd/osd_operations/client_request.cc | 3 +++ .../osd/osd_operations/client_request.h | 1 + .../osd/osd_operations/common/pg_pipeline.h | 3 +++ .../osd_operations/internal_client_request.cc | 2 ++ .../osd_operations/internal_client_request.h | 1 + 6 files changed, 32 insertions(+) diff --git a/src/crimson/osd/osd_operation_external_tracking.h b/src/crimson/osd/osd_operation_external_tracking.h index 4fffd8e82b00b..28738a11dda4d 100644 --- a/src/crimson/osd/osd_operation_external_tracking.h +++ b/src/crimson/osd/osd_operation_external_tracking.h @@ -38,6 +38,8 @@ struct LttngBackend BlockingEvent::ExitBarrierEvent::Backend, ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent::Backend, ClientRequest::PGPipeline::GetOBC::BlockingEvent::Backend, + ClientRequest::PGPipeline::LockOBC::BlockingEvent::Backend, + ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent::Backend, ClientRequest::PGPipeline::Process::BlockingEvent::Backend, ClientRequest::PGPipeline::WaitRepop::BlockingEvent::Backend, ClientRequest::PGPipeline::WaitRepop::BlockingEvent::ExitBarrierEvent::Backend, @@ -127,6 +129,15 @@ struct LttngBackend const ClientRequest::PGPipeline::GetOBC& blocker) override { } + void handle(ClientRequest::PGPipeline::LockOBC::BlockingEvent& ev, + const Operation& op, + const ClientRequest::PGPipeline::LockOBC& blocker) override { + } + + void handle(ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent& ev, + const Operation& op) override { + } + void handle(ClientRequest::PGPipeline::Process::BlockingEvent& ev, const Operation& op, const ClientRequest::PGPipeline::Process& blocker) override { @@ -169,6 +180,8 @@ struct HistoricBackend BlockingEvent::ExitBarrierEvent::Backend, ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent::Backend, ClientRequest::PGPipeline::GetOBC::BlockingEvent::Backend, + ClientRequest::PGPipeline::LockOBC::BlockingEvent::Backend, + ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent::Backend, ClientRequest::PGPipeline::Process::BlockingEvent::Backend, ClientRequest::PGPipeline::WaitRepop::BlockingEvent::Backend, ClientRequest::PGPipeline::WaitRepop::BlockingEvent::ExitBarrierEvent::Backend, @@ -258,6 +271,15 @@ struct HistoricBackend const ClientRequest::PGPipeline::GetOBC& blocker) override { } + void handle(ClientRequest::PGPipeline::LockOBC::BlockingEvent& ev, + const Operation& op, + const ClientRequest::PGPipeline::LockOBC& blocker) override { + } + + void handle(ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent& ev, + const Operation& op) override { + } + void handle(ClientRequest::PGPipeline::Process::BlockingEvent& ev, const Operation& op, const ClientRequest::PGPipeline::Process& blocker) override { diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 3f2399684a321..b48e52ff31eda 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -343,6 +343,9 @@ ClientRequest::process_op( DEBUGDPP("{}.{}: past scrub blocker, getting obc", *pg, *this, this_instance_id); + // call with_locked_obc() in order, but wait concurrently for loading. + ihref.enter_stage_sync( + client_pp(*pg).lock_obc, *this); auto process = pg->with_locked_obc( m->get_hobj(), op_info, [FNAME, this, pg, this_instance_id, &ihref] ( diff --git a/src/crimson/osd/osd_operations/client_request.h b/src/crimson/osd/osd_operations/client_request.h index d5cbc94c1c40b..259d616ec24c4 100644 --- a/src/crimson/osd/osd_operations/client_request.h +++ b/src/crimson/osd/osd_operations/client_request.h @@ -115,6 +115,7 @@ public: PGPipeline::RecoverMissingSnaps::BlockingEvent, scrub::PGScrubber::BlockingEvent, PGPipeline::GetOBC::BlockingEvent, + PGPipeline::LockOBC::BlockingEvent, PGPipeline::Process::BlockingEvent, PGPipeline::WaitRepop::BlockingEvent, PGPipeline::SendReply::BlockingEvent, diff --git a/src/crimson/osd/osd_operations/common/pg_pipeline.h b/src/crimson/osd/osd_operations/common/pg_pipeline.h index 58fa07b8b4d25..d6a5f686654b4 100644 --- a/src/crimson/osd/osd_operations/common/pg_pipeline.h +++ b/src/crimson/osd/osd_operations/common/pg_pipeline.h @@ -23,6 +23,9 @@ protected: struct GetOBC : OrderedExclusivePhaseT { static constexpr auto type_name = "CommonPGPipeline::get_obc"; } get_obc; + struct LockOBC : OrderedConcurrentPhaseT { + static constexpr auto type_name = "CommonPGPipeline::lock_obc"; + } lock_obc; struct Process : OrderedExclusivePhaseT { static constexpr auto type_name = "CommonPGPipeline::process"; } process; diff --git a/src/crimson/osd/osd_operations/internal_client_request.cc b/src/crimson/osd/osd_operations/internal_client_request.cc index 7be582ff27619..d72c128683da9 100644 --- a/src/crimson/osd/osd_operations/internal_client_request.cc +++ b/src/crimson/osd/osd_operations/internal_client_request.cc @@ -84,6 +84,8 @@ seastar::future<> InternalClientRequest::start() [[maybe_unused]] const int ret = op_info.set_from_op( std::as_const(osd_ops), pg->get_pgid().pgid, *pg->get_osdmap()); assert(ret == 0); + // call with_locked_obc() in order, but wait concurrently for loading. + enter_stage_sync(client_pp().lock_obc); return pg->with_locked_obc(get_target_oid(), op_info, [&osd_ops, this](auto, auto obc) { return enter_stage(client_pp().process diff --git a/src/crimson/osd/osd_operations/internal_client_request.h b/src/crimson/osd/osd_operations/internal_client_request.h index 8eed12e050e19..97ce0492f5475 100644 --- a/src/crimson/osd/osd_operations/internal_client_request.h +++ b/src/crimson/osd/osd_operations/internal_client_request.h @@ -56,6 +56,7 @@ public: PGActivationBlocker::BlockingEvent, CommonPGPipeline::RecoverMissing::BlockingEvent, CommonPGPipeline::GetOBC::BlockingEvent, + CommonPGPipeline::LockOBC::BlockingEvent, CommonPGPipeline::Process::BlockingEvent, CompletionEvent > tracking_events; -- 2.39.5