From 7ac64b0b245798b1d4a85b1da86497d2baf2bceb Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 1 Oct 2024 13:05:03 -0700 Subject: [PATCH] crimson: OpsExecuter no longer needs to be a lw shared ptr ClientRequest and InternalClientRequest can declare them as auto variables. Signed-off-by: Samuel Just --- src/crimson/osd/ops_executer.h | 6 ++--- .../osd/osd_operations/client_request.cc | 3 +-- .../osd_operations/internal_client_request.cc | 2 +- src/crimson/osd/pg.cc | 23 +++++++++---------- src/crimson/osd/pg.h | 4 ++-- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 3a7aaef7cd0..068f510d1ef 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -40,7 +40,7 @@ namespace crimson::osd { class PG; // OpsExecuter -- a class for executing ops targeting a certain object. -class OpsExecuter : public seastar::enable_lw_shared_from_this { +class OpsExecuter { friend class SnapTrimObjSubEvent; using call_errorator = crimson::errorator< @@ -549,14 +549,14 @@ template struct OpsExecuter::RollbackHelper { void rollback_obc_if_modified(); void rollback_obc_if_modified(const std::error_code& e); - seastar::lw_shared_ptr ox; + OpsExecuter *ox; Func func; }; template inline OpsExecuter::RollbackHelper OpsExecuter::create_rollbacker(Func&& func) { - return {shared_from_this(), std::forward(func)}; + return {this, std::forward(func)}; } template diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index c226222fa0c..a89fb2c84bc 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -502,8 +502,7 @@ ClientRequest::do_process( co_return; } - auto ox = seastar::make_lw_shared( - pg, obc, op_info, *m, r_conn, snapc); + OpsExecuter ox(pg, obc, op_info, *m, r_conn, snapc); auto ret = co_await pg->run_executer( ox, obc, op_info, m->ops ).si_then([]() -> std::optional { diff --git a/src/crimson/osd/osd_operations/internal_client_request.cc b/src/crimson/osd/osd_operations/internal_client_request.cc index 6ad447cf32e..9e5867caf80 100644 --- a/src/crimson/osd/osd_operations/internal_client_request.cc +++ b/src/crimson/osd/osd_operations/internal_client_request.cc @@ -57,7 +57,7 @@ InternalClientRequest::do_process( { LOG_PREFIX(InternalClientRequest::do_process); auto params = get_do_osd_ops_params(); - auto ox = seastar::make_lw_shared( + OpsExecuter ox( pg, obc, op_info, params, params.get_connection(), SnapContext{}); co_await pg->run_executer( ox, obc, op_info, osd_ops diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 9cdd19d0133..744a1dbc02b 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1080,13 +1080,13 @@ PG::interruptible_future PG::submit_error_log( } PG::run_executer_fut PG::run_executer( - seastar::lw_shared_ptr ox, + OpsExecuter &ox, ObjectContextRef obc, const OpInfo &op_info, std::vector& ops) { LOG_PREFIX(PG::run_executer); - auto rollbacker = ox->create_rollbacker( + auto rollbacker = ox.create_rollbacker( [stored_obc=duplicate_obc(obc)](auto &obc) mutable { obc->update_from(*stored_obc); }); @@ -1095,16 +1095,16 @@ PG::run_executer_fut PG::run_executer( }); for (auto &op: ops) { - DEBUGDPP("object {} handle op {}", *this, ox->get_target(), op); - co_await ox->execute_op(op); + DEBUGDPP("object {} handle op {}", *this, ox.get_target(), op); + co_await ox.execute_op(op); } - DEBUGDPP("object {} all operations successful", *this, ox->get_target()); + DEBUGDPP("object {} all operations successful", *this, ox.get_target()); // check for full - if ((ox->delta_stats.num_bytes > 0 || - ox->delta_stats.num_objects > 0) && + if ((ox.delta_stats.num_bytes > 0 || + ox.delta_stats.num_objects > 0) && get_pgpool().info.has_flag(pg_pool_t::FLAG_FULL)) { - const auto& m = ox->get_message(); + const auto& m = ox.get_message(); if (m.get_reqid().name.is_mds() || // FIXME: ignore MDS for now m.has_flag(CEPH_OSD_FLAG_FULL_FORCE)) { INFODPP("full, but proceeding due to FULL_FORCE, or MDS", *this); @@ -1129,13 +1129,12 @@ PG::run_executer_fut PG::run_executer( } PG::submit_executer_fut PG::submit_executer( - seastar::lw_shared_ptr ox, - const std::vector& ops) -{ + OpsExecuter &&ox, + const std::vector& ops) { LOG_PREFIX(PG::submit_executer); // transaction must commit at this point return std::move( - *ox + ox ).flush_changes_n_do_ops_effects( ops, snap_mapper, diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 3a8ddad922a..604f49005ff 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -658,7 +658,7 @@ private: run_executer_ertr>; using run_executer_fut = run_executer_iertr::future<>; run_executer_fut run_executer( - seastar::lw_shared_ptr ox, + OpsExecuter &ox, ObjectContextRef obc, const OpInfo &op_info, std::vector& ops); @@ -669,7 +669,7 @@ private: using submit_executer_fut = interruptible_future< submit_executer_ret>; submit_executer_fut submit_executer( - seastar::lw_shared_ptr ox, + OpsExecuter &&ox, const std::vector& ops); struct do_osd_ops_params_t; -- 2.39.5