]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: dissect PgOpsExecuter from OpsExecuter.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 7 Aug 2020 15:55:32 +0000 (17:55 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Sun, 9 Aug 2020 22:40:34 +0000 (00:40 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/ops_executer.cc
src/crimson/osd/ops_executer.h
src/crimson/osd/pg.cc

index 5d0eaa21a1a968612b1551632ae9b7336c44cec4..7f7ce0e0c3bd44b7d649d534fc00faab0806fa73 100644 (file)
@@ -947,7 +947,7 @@ static seastar::future<> do_pgls_filtered(
 }
 
 seastar::future<>
-OpsExecuter::execute_pg_op(OSDOp& osd_op)
+PgOpsExecuter::execute_pg_op(OSDOp& osd_op)
 {
   logger().warn("handling op {}", ceph_osd_op_name(osd_op.op.op));
   switch (const ceph_osd_op& op = osd_op.op; op.op) {
index 2f64b225c3f2b3c6a9f68b97318a924519ab122a..1dbf5e04639547c72f5ffdb97957761ec6e74a1f 100644 (file)
@@ -35,6 +35,8 @@ class PGLSFilter;
 class OSDOp;
 
 namespace crimson::osd {
+
+// PgOpsExecuter -- a class for executing ops targeting a certain object.
 class OpsExecuter {
   using call_errorator = crimson::errorator<
     crimson::stateful_ec,
@@ -159,13 +161,6 @@ private:
     return std::forward<Func>(f)(backend, obc->obs, txn);
   }
 
-  // PG operations are being provided with pg instead of os.
-  template <class Func>
-  auto do_pg_op(Func&& f) {
-    return std::forward<Func>(f)(std::as_const(pg),
-                                 std::as_const(msg->get_hobj().nspace));
-  }
-
   decltype(auto) dont_do_legacy_op() {
     return crimson::ct_error::operation_not_supported::make();
   }
@@ -178,12 +173,8 @@ public:
       backend(pg.get_backend()),
       msg(std::move(msg)) {
   }
-  OpsExecuter(PG& pg, Ref<MOSDOp> msg)
-    : OpsExecuter{ObjectContextRef(), nullptr, pg, std::move(msg)}
-  {}
 
   osd_op_errorator::future<> execute_osd_op(class OSDOp& osd_op);
-  seastar::future<> execute_pg_op(class OSDOp& osd_op);
 
   template <typename Func, typename MutFunc>
   osd_op_errorator::future<> flush_changes(Func&& func, MutFunc&& mut_func) &&;
@@ -275,4 +266,25 @@ OpsExecuter::osd_op_errorator::future<> OpsExecuter::flush_changes(
   }
 }
 
+// PgOpsExecuter -- a class for executing ops targeting a certain PG.
+class PgOpsExecuter {
+public:
+  PgOpsExecuter(PG& pg, Ref<MOSDOp> msg)
+    : pg(pg), msg(std::move(msg)) {
+  }
+
+  seastar::future<> execute_pg_op(class OSDOp& osd_op);
+
+private:
+  // PG operations are being provided with pg instead of os.
+  template <class Func>
+  auto do_pg_op(Func&& f) {
+    return std::forward<Func>(f)(std::as_const(pg),
+                                 std::as_const(msg->get_hobj().nspace));
+  }
+
+  PG& pg;
+  Ref<MOSDOp> msg;
+};
+
 } // namespace crimson::osd
index 5b2b64fb3fd1f83017b97a4f2efacce172dc240f..783dcbf4672e058f67babc21061a63c02763044b 100644 (file)
@@ -676,7 +676,7 @@ seastar::future<Ref<MOSDOpReply>> PG::do_pg_ops(Ref<MOSDOp> m)
     throw crimson::common::system_shutdown_exception();
   }
 
-  auto ox = std::make_unique<OpsExecuter>(*this/* as const& */, m);
+  auto ox = std::make_unique<PgOpsExecuter>(*this/* as const& */, m);
   return seastar::do_for_each(m->ops, [ox = ox.get()](OSDOp& osd_op) {
     logger().debug("will be handling pg op {}", ceph_osd_op_name(osd_op.op.op));
     return ox->execute_pg_op(osd_op);