]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: Store a reference to PG inside OpsExecuter
authorAmnon Hanuhov <ahanukov@redhat.com>
Thu, 24 Jun 2021 15:59:53 +0000 (18:59 +0300)
committerAmnon Hanuhov <AmnonSWE@gmail.com>
Fri, 14 Jan 2022 12:13:13 +0000 (14:13 +0200)
This is needed as some ObjClass methods make use of pg information related to the given cls_method_context_t

Signed-off-by: Amnon Hanuhov <ahanukov@redhat.com>
src/crimson/osd/ops_executer.h
src/crimson/osd/pg.cc

index d411d500ec7e6c9c5f5e6f71a550a85480a5c4f3..d84d43ad712b85c202f53d2651697e7a3eb39510 100644 (file)
@@ -151,6 +151,7 @@ private:
     virtual ~effect_t() = default;
   };
 
+  Ref<PG> pg; // for the sake of object class
   ObjectContextRef obc;
   const OpInfo& op_info;
   const pg_pool_t& pool_info;  // for the sake of the ObjClass API
@@ -236,12 +237,14 @@ private:
 
 public:
   template <class MsgT>
-  OpsExecuter(ObjectContextRef obc,
+  OpsExecuter(Ref<PG> pg,
+              ObjectContextRef obc,
               const OpInfo& op_info,
               const pg_pool_t& pool_info,
               PGBackend& backend,
               const MsgT& msg)
-    : obc(std::move(obc)),
+    : pg(std::move(pg)),
+      obc(std::move(obc)),
       op_info(op_info),
       pool_info(pool_info),
       backend(backend),
@@ -262,9 +265,7 @@ public:
   using rep_op_fut_t =
     interruptible_future<rep_op_fut_tuple>;
   template <typename MutFunc>
-  rep_op_fut_t flush_changes_n_do_ops_effects(
-    Ref<PG> pg,
-    MutFunc&& mut_func) &&;
+  rep_op_fut_t flush_changes_n_do_ops_effects(MutFunc&& mut_func) &&;
 
   const hobject_t &get_target() const {
     return obc->obs.oi.soid;
@@ -330,7 +331,7 @@ auto OpsExecuter::with_effect_on_obc(
 
 template <typename MutFunc>
 OpsExecuter::rep_op_fut_t
-OpsExecuter::flush_changes_n_do_ops_effects(Ref<PG> pg, MutFunc&& mut_func) &&
+OpsExecuter::flush_changes_n_do_ops_effects(MutFunc&& mut_func) &&
 {
   const bool want_mutate = !txn.empty();
   // osd_op_params are instantiated by every wr-like operation.
index aee8e833165726233b4f3e87227b03520b3916b6..7fd940f1e76a5733b1fab1a48e4e2f8bd123a601 100644 (file)
@@ -683,7 +683,6 @@ PG::do_osd_ops_execute(
       ox->get_target());
     peering_state.apply_op_stats(ox->get_target(), ox->get_stats());
     return std::move(*ox).flush_changes_n_do_ops_effects(
-      Ref<PG>{this},
       [this, &op_info, &ops] (auto&& txn,
                               auto&& obc,
                               auto&& osd_op_p,
@@ -751,7 +750,7 @@ PG::do_osd_ops(
   }
   return do_osd_ops_execute<MURef<MOSDOpReply>>(
     seastar::make_lw_shared<OpsExecuter>(
-      std::move(obc), op_info, get_pool().info, get_backend(), *m),
+      Ref<PG>{this}, std::move(obc), op_info, *m),
     m->ops,
     op_info,
     [this, m, rvec = op_info.allows_returnvec()] {
@@ -795,7 +794,7 @@ PG::do_osd_ops(
 {
   return do_osd_ops_execute<void>(
     seastar::make_lw_shared<OpsExecuter>(
-      std::move(obc), op_info, get_pool().info, get_backend(), msg_params),
+      Ref<PG>{this}, std::move(obc), op_info, msg_params),
     ops,
     std::as_const(op_info),
     std::move(success_func),