]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/osd_operations/client_request: cleanup, simplify recover_missings
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 22 Apr 2024 06:05:26 +0000 (14:05 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 9 May 2024 02:06:39 +0000 (10:06 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/osd/osd_operations/client_request_common.cc
src/crimson/osd/osd_operations/client_request_common.h

index b1c8d37f1d981107c56cdad5851eb38861614921..657bdf7bd60bbf4bc7fc3fdc15130e091568dbe4 100644 (file)
@@ -17,7 +17,7 @@ namespace crimson::osd {
 
 InterruptibleOperation::template interruptible_future<>
 CommonClientRequest::recover_missings(
-  Ref<PG> &pg,
+  Ref<PG> pg,
   const hobject_t& soid,
   std::set<snapid_t> &&snaps,
   const osd_reqid_t& reqid)
@@ -32,43 +32,43 @@ CommonClientRequest::recover_missings(
     pg, soid.get_head(), reqid
   ).then_interruptible([snaps=std::move(snaps), pg, soid, reqid]() mutable {
     if (snaps.empty()) {
-      return ObjectContextLoader::load_obc_iertr::now();
+      return InterruptibleOperation::interruptor::now();
     }
-    return pg->obc_loader.with_obc<RWState::RWREAD>(
-      soid.get_head(),
-      [snaps=std::move(snaps), pg, soid, reqid](auto head, auto) mutable {
-      return seastar::do_with(
-       std::move(snaps),
-       [pg, soid, head, reqid](auto &snaps) mutable {
-       return InterruptibleOperation::interruptor::do_for_each(
-         snaps,
-         [pg, soid, head, reqid](auto &snap) mutable ->
-         InterruptibleOperation::template interruptible_future<> {
-         auto coid = head->obs.oi.soid;
-         coid.snap = snap;
-         auto oid = resolve_oid(head->get_head_ss(), coid);
-         /* Rollback targets may legitimately not exist if, for instance,
-          * the object is an rbd block which happened to be sparse and
-          * therefore non-existent at the time of the specified snapshot.
-          * In such a case, rollback will simply delete the object.  Here,
-          * we skip the oid as there is no corresponding clone to recover.
-          * See https://tracker.ceph.com/issues/63821 */
-         if (oid) {
-           return do_recover_missing(pg, *oid, reqid);
-         } else {
-           return seastar::now();
-         }
-       });
-      });
+    return seastar::do_with(
+      std::move(snaps),
+      [pg, soid, reqid](auto& snaps) {
+      return pg->obc_loader.with_obc<RWState::RWREAD>(
+        soid.get_head(),
+        [&snaps, pg, soid, reqid](auto head, auto) {
+        return InterruptibleOperation::interruptor::do_for_each(
+          snaps,
+          [pg, soid, head, reqid](auto &snap)
+          -> InterruptibleOperation::template interruptible_future<> {
+          auto coid = head->obs.oi.soid;
+          coid.snap = snap;
+          auto oid = resolve_oid(head->get_head_ss(), coid);
+          /* Rollback targets may legitimately not exist if, for instance,
+           * the object is an rbd block which happened to be sparse and
+           * therefore non-existent at the time of the specified snapshot.
+           * In such a case, rollback will simply delete the object.  Here,
+           * we skip the oid as there is no corresponding clone to recover.
+           * See https://tracker.ceph.com/issues/63821 */
+          if (oid) {
+            return do_recover_missing(pg, *oid, reqid);
+          } else {
+            return seastar::now();
+          }
+        });
+      }).handle_error_interruptible(
+        crimson::ct_error::assert_all("unexpected error")
+      );
     });
-  }).handle_error_interruptible(
-    crimson::ct_error::assert_all("unexpected error")
-  );
+  });
 }
 
 typename InterruptibleOperation::template interruptible_future<>
 CommonClientRequest::do_recover_missing(
-  Ref<PG>& pg,
+  Ref<PG> pg,
   const hobject_t& soid,
   const osd_reqid_t& reqid)
 {
index 738f1b1f7bb18dec7e45c5ed8832a50320f7b339..906ce53b50a95d16a9db568d75d25015ce5c06cc 100644 (file)
@@ -13,14 +13,14 @@ struct CommonClientRequest {
 
   static InterruptibleOperation::template interruptible_future<>
   recover_missings(
-    Ref<PG> &pg,
+    Ref<PG> pg,
     const hobject_t& soid,
     std::set<snapid_t> &&snaps,
     const osd_reqid_t& reqid);
 
   static InterruptibleOperation::template interruptible_future<>
   do_recover_missing(
-    Ref<PG>& pg,
+    Ref<PG> pg,
     const hobject_t& soid,
     const osd_reqid_t& reqid);