]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: lift continuation in PGMeta::load()
authorKefu Chai <kchai@redhat.com>
Thu, 22 Aug 2019 08:47:19 +0000 (16:47 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Aug 2019 14:55:59 +0000 (22:55 +0800)
after making `open_collection()` return a future, we don't need to chain
the body of `PGMeta::load()` after `omap_get_values()`. instead we can
lift it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg_meta.cc

index 5510972eb6178cc7715401ce92a317a591faeee8..30ef48b37c888692bbf16bf4f0949b9530352806 100644 (file)
@@ -62,39 +62,38 @@ seastar::future<pg_info_t, PastIntervals> PGMeta::load()
                                 {string{infover_key},
                                  string{info_key},
                                  string{biginfo_key},
-                                 string{fastinfo_key}}).then(
-    [this](auto&& values) {
-      {
-        // sanity check
-        auto infover = find_value<__u8>(values, infover_key);
-        assert(infover);
-        if (infover < 10) {
-          throw std::runtime_error("incompatible pg meta");
-        }
-      }
-      pg_info_t info;
-      {
-        auto found = find_value<pg_info_t>(values, info_key);
-        assert(found);
-        info = *std::move(found);
+                                 string{fastinfo_key}});
+  }).then([this](auto&& values) {
+    {
+      // sanity check
+      auto infover = find_value<__u8>(values, infover_key);
+      assert(infover);
+      if (infover < 10) {
+        throw std::runtime_error("incompatible pg meta");
       }
-      PastIntervals past_intervals;
-      {
-        using biginfo_t = std::pair<PastIntervals, decltype(info.purged_snaps)>;
-        auto big_info = find_value<biginfo_t>(values, biginfo_key);
-        assert(big_info);
-        past_intervals = std::move(big_info->first);
-        info.purged_snaps = std::move(big_info->second);
-      }
-      {
-        auto fast_info = find_value<pg_fast_info_t>(values, fastinfo_key);
-        if (fast_info) {
-          fast_info->try_apply_to(&info);
-        }
+    }
+    pg_info_t info;
+    {
+      auto found = find_value<pg_info_t>(values, info_key);
+      assert(found);
+      info = *std::move(found);
+    }
+    PastIntervals past_intervals;
+    {
+      using biginfo_t = std::pair<PastIntervals, decltype(info.purged_snaps)>;
+      auto big_info = find_value<biginfo_t>(values, biginfo_key);
+      assert(big_info);
+      past_intervals = std::move(big_info->first);
+      info.purged_snaps = std::move(big_info->second);
+    }
+    {
+      auto fast_info = find_value<pg_fast_info_t>(values, fastinfo_key);
+      if (fast_info) {
+        fast_info->try_apply_to(&info);
       }
-      return seastar::make_ready_future<pg_info_t, PastIntervals>(
-        std::move(info),
-        std::move(past_intervals));
-    });
+    }
+    return seastar::make_ready_future<pg_info_t, PastIntervals>(
+      std::move(info),
+      std::move(past_intervals));
   });
 }