]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: drop PGBackend& from OpsExecuter ctor
authorAmnon Hanuhov <amnonswe@gmail.com>
Wed, 11 Aug 2021 16:49:44 +0000 (19:49 +0300)
committerAmnon Hanuhov <AmnonSWE@gmail.com>
Fri, 14 Jan 2022 12:13:13 +0000 (14:13 +0200)
OpsExecuter holds a Ref<PG> so the PGBackend can be extracted from it
using get_backend()

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

index f947a4fab44b3dcc703271a8d93b948e37ac7774..c38f3e034e731ca0b6fbbae9518effa126c4ece0 100644 (file)
@@ -442,6 +442,24 @@ OpsExecuter::watch_ierrorator::future<> OpsExecuter::do_op_notify_ack(
   });
 }
 
+// Defined here because there is a circular dependency between OpsExecuter and PG
+template <class Func>
+auto OpsExecuter::do_const_op(Func&& f) {
+  // TODO: pass backend as read-only
+  return std::forward<Func>(f)(pg->get_backend(), std::as_const(obc->obs));
+}
+
+// Defined here because there is a circular dependency between OpsExecuter and PG
+template <class Func>
+auto OpsExecuter::do_write_op(Func&& f, bool um) {
+  ++num_write;
+  if (!osd_op_params) {
+    osd_op_params.emplace();
+  }
+  user_modify = um;
+  return std::forward<Func>(f)(pg->get_backend(), obc->obs, txn);
+}
+
 OpsExecuter::interruptible_errorated_future<OpsExecuter::osd_op_errorator>
 OpsExecuter::execute_op(OSDOp& osd_op)
 {
index d3317d150e27e97d5b1ae009c4a24bd6c513edc2..803b9fda0de029d2d1695a3fc36850429750aef8 100644 (file)
@@ -154,7 +154,6 @@ private:
   Ref<PG> pg; // for the sake of object class
   ObjectContextRef obc;
   const OpInfo& op_info;
-  PGBackend& backend;
   ceph::static_ptr<ExecutableMessage,
                    sizeof(ExecutableMessagePimpl<void>)> msg;
   std::optional<osd_op_params_t> osd_op_params;
@@ -208,10 +207,7 @@ private:
     const ObjectState& os);
 
   template <class Func>
-  auto do_const_op(Func&& f) {
-    // TODO: pass backend as read-only
-    return std::forward<Func>(f)(backend, std::as_const(obc->obs));
-  }
+  auto do_const_op(Func&& f);
 
   template <class Func>
   auto do_read_op(Func&& f) {
@@ -221,14 +217,7 @@ private:
   }
 
   template <class Func>
-  auto do_write_op(Func&& f, bool um) {
-    ++num_write;
-    if (!osd_op_params) {
-      osd_op_params.emplace();
-    }
-    user_modify = um;
-    return std::forward<Func>(f)(backend, obc->obs, txn);
-  }
+  auto do_write_op(Func&& f, bool um);
 
   decltype(auto) dont_do_legacy_op() {
     return crimson::ct_error::operation_not_supported::make();
@@ -239,12 +228,10 @@ public:
   OpsExecuter(Ref<PG> pg,
               ObjectContextRef obc,
               const OpInfo& op_info,
-              PGBackend& backend,
               const MsgT& msg)
     : pg(std::move(pg)),
       obc(std::move(obc)),
       op_info(op_info),
-      backend(backend),
       msg(std::in_place_type_t<ExecutableMessagePimpl<MsgT>>{}, &msg) {
   }
 
index 2e4b0a5300e7a019fe520d463e6b1693ae06a5bb..7fd940f1e76a5733b1fab1a48e4e2f8bd123a601 100644 (file)
@@ -750,7 +750,7 @@ PG::do_osd_ops(
   }
   return do_osd_ops_execute<MURef<MOSDOpReply>>(
     seastar::make_lw_shared<OpsExecuter>(
-      Ref<PG>{this}, std::move(obc), op_info, get_backend(), *m),
+      Ref<PG>{this}, std::move(obc), op_info, *m),
     m->ops,
     op_info,
     [this, m, rvec = op_info.allows_returnvec()] {
@@ -794,7 +794,7 @@ PG::do_osd_ops(
 {
   return do_osd_ops_execute<void>(
     seastar::make_lw_shared<OpsExecuter>(
-      Ref<PG>{this}, std::move(obc), op_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),