]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: OpsExecuter no longer needs to be a lw shared ptr
authorSamuel Just <sjust@redhat.com>
Tue, 1 Oct 2024 20:05:03 +0000 (13:05 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 15 Oct 2024 03:37:26 +0000 (20:37 -0700)
ClientRequest and InternalClientRequest can declare them
as auto variables.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/ops_executer.h
src/crimson/osd/osd_operations/client_request.cc
src/crimson/osd/osd_operations/internal_client_request.cc
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index 3a7aaef7cd0364d95a0a34797f0b3e1cc7e35618..068f510d1ef826f90d323e24b5206f8c9bb793c2 100644 (file)
@@ -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<OpsExecuter> {
+class OpsExecuter {
   friend class SnapTrimObjSubEvent;
 
   using call_errorator = crimson::errorator<
@@ -549,14 +549,14 @@ template <class Func>
 struct OpsExecuter::RollbackHelper {
   void rollback_obc_if_modified();
   void rollback_obc_if_modified(const std::error_code& e);
-  seastar::lw_shared_ptr<OpsExecuter> ox;
+  OpsExecuter *ox;
   Func func;
 };
 
 template <class Func>
 inline OpsExecuter::RollbackHelper<Func>
 OpsExecuter::create_rollbacker(Func&& func) {
-  return {shared_from_this(), std::forward<Func>(func)};
+  return {this, std::forward<Func>(func)};
 }
 
 template <class Func>
index c226222fa0c75a828818df551310d567f524077e..a89fb2c84bc562f1187708c7b0e68901452c1346 100644 (file)
@@ -502,8 +502,7 @@ ClientRequest::do_process(
     co_return;
   }
 
-  auto ox = seastar::make_lw_shared<OpsExecuter>(
-    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<std::error_code> {
index 6ad447cf32ee42c9c0dada8693ec7d0dd702c8c2..9e5867caf8067a8a04ee4cb47787f6bb61c42a7f 100644 (file)
@@ -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>(
+  OpsExecuter ox(
     pg, obc, op_info, params, params.get_connection(), SnapContext{});
   co_await pg->run_executer(
     ox, obc, op_info, osd_ops
index 9cdd19d01332f5003b59853da5765b8bf2476b3c..744a1dbc02b974e1c090e2d31b4909b5832cb1c6 100644 (file)
@@ -1080,13 +1080,13 @@ PG::interruptible_future<eversion_t> PG::submit_error_log(
 }
 
 PG::run_executer_fut PG::run_executer(
-  seastar::lw_shared_ptr<OpsExecuter> ox,
+  OpsExecuter &ox,
   ObjectContextRef obc,
   const OpInfo &op_info,
   std::vector<OSDOp>& 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<OpsExecuter> ox,
-  const std::vector<OSDOp>& ops)
-{
+  OpsExecuter &&ox,
+  const std::vector<OSDOp>& 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,
index 3a8ddad922a501d7421b60ecb5583c8cff8a4b5d..604f49005ff040a82d1abe8b9a70b178eab0a5b2 100644 (file)
@@ -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<OpsExecuter> ox,
+    OpsExecuter &ox,
     ObjectContextRef obc,
     const OpInfo &op_info,
     std::vector<OSDOp>& ops);
@@ -669,7 +669,7 @@ private:
   using submit_executer_fut = interruptible_future<
     submit_executer_ret>;
   submit_executer_fut submit_executer(
-    seastar::lw_shared_ptr<OpsExecuter> ox,
+    OpsExecuter &&ox,
     const std::vector<OSDOp>& ops);
 
   struct do_osd_ops_params_t;