]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/osd_operations/snaptrim_event: start to use coroutines
authorMatan Breizman <mbreizma@redhat.com>
Tue, 20 Aug 2024 14:11:25 +0000 (14:11 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 9 Sep 2024 09:38:08 +0000 (09:38 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/osd/osd_operations/snaptrim_event.cc

index 3a3645b9cf6fd2cd6025aac5e8f1e55334cce93a..21d9c116aab22d1bb200860db3cc4c4192e96276 100644 (file)
@@ -402,36 +402,29 @@ SnapTrimObjSubEvent::start()
   // lock both clone's and head's obcs
   co_await pg->obc_loader.with_obc<RWState::RWWRITE>(
     coid,
-    [this](auto head_obc, auto clone_obc) {
+    [this](auto head_obc, auto clone_obc) -> ObjectContextLoader::load_obc_iertr::future<> {
       logger().debug("{}: got clone_obc={}", *this, clone_obc->get_oid());
-      return enter_stage<interruptor>(
-        client_pp().process
-      ).then_interruptible(
-        [this,clone_obc=std::move(clone_obc), head_obc=std::move(head_obc)]() mutable {
-         logger().debug("{}: processing clone_obc={}", *this, clone_obc->get_oid());
-         return remove_or_update(
-           clone_obc, head_obc
-         ).safe_then_interruptible(
-           [clone_obc, this](auto&& txn) mutable {
-           return pg->submit_transaction(
+
+      co_await enter_stage<interruptor>(client_pp().process);
+
+      logger().debug("{}: processing clone_obc={}", *this, clone_obc->get_oid());
+
+      auto txn = co_await remove_or_update(clone_obc, head_obc);
+
+      auto [submitted, all_completed] = co_await pg->submit_transaction(
              std::move(clone_obc),
              std::move(txn),
              std::move(osd_op_p),
              std::move(log_entries)
-           ).then_interruptible([this](auto p) {
-             auto &submitted = std::get<0>(p);
-             auto &all_completed = std::get<1>(p);
-             return submitted.then_interruptible(
-               [this, all_completed=std::move(all_completed)]() mutable {
-                 return enter_stage<interruptor>(
-                   client_pp().wait_repop
-                 ).then_interruptible([all_completed=std::move(all_completed)]() mutable{
-                   return std::move(all_completed);
-                 });
-               });
-           });
-         });
-       });
+      );
+
+      co_await std::move(submitted);
+
+      co_await enter_stage<interruptor>(client_pp().wait_repop);
+
+      co_await std::move(all_completed);
+
+      co_return;
     },
     false
   ).handle_error_interruptible(