]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg_backend: convert PGBackend::list_objects to a coroutine
authorSamuel Just <sjust@redhat.com>
Tue, 26 Mar 2024 05:31:08 +0000 (05:31 +0000)
committerSamuel Just <sjust@redhat.com>
Wed, 27 Mar 2024 02:36:54 +0000 (02:36 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/pg_backend.cc

index bcdf2a6b1782f7ed18c4cd534dc35945aa3032a2..0c9822365d141cf8345c6267c0621e9a30f8a01a 100644 (file)
@@ -17,6 +17,7 @@
 #include "common/Checksummer.h"
 #include "common/Clock.h"
 
+#include "crimson/common/coroutine.h"
 #include "crimson/common/exception.h"
 #include "crimson/common/tmap_helpers.h"
 #include "crimson/os/futurized_collection.h"
@@ -1085,30 +1086,26 @@ PGBackend::list_objects(
 {
   auto gstart = start.is_min() ? ghobject_t{} : ghobject_t{start, 0, shard};
   auto gend = end.is_max() ? ghobject_t::get_max() : ghobject_t{end, 0, shard};
-  return interruptor::make_interruptible(store->list_objects(coll,
-                                        gstart,
-                                        gend,
-                                        limit))
-    .then_interruptible([](auto ret) {
-      auto& [gobjects, next] = ret;
-      std::vector<hobject_t> objects;
-      boost::copy(gobjects |
-        boost::adaptors::filtered([](const ghobject_t& o) {
-          if (o.is_pgmeta()) {
-            return false;
-          } else if (o.hobj.is_temp()) {
-            return false;
-          } else {
-            return o.is_no_gen();
-          }
-        }) |
-        boost::adaptors::transformed([](const ghobject_t& o) {
-          return o.hobj;
-        }),
-        std::back_inserter(objects));
-      return seastar::make_ready_future<std::tuple<std::vector<hobject_t>, hobject_t>>(
-        std::make_tuple(objects, next.hobj));
-    });
+  auto [gobjects, next] = co_await interruptor::make_interruptible(
+    store->list_objects(coll, gstart, gend, limit));
+
+  std::vector<hobject_t> objects;
+  boost::copy(
+    gobjects |
+    boost::adaptors::filtered([](const ghobject_t& o) {
+      if (o.is_pgmeta()) {
+       return false;
+      } else if (o.hobj.is_temp()) {
+       return false;
+      } else {
+       return o.is_no_gen();
+      }
+    }) |
+    boost::adaptors::transformed([](const ghobject_t& o) {
+      return o.hobj;
+    }),
+    std::back_inserter(objects));
+  co_return std::make_tuple(objects, next.hobj);
 }
 
 PGBackend::setxattr_ierrorator::future<> PGBackend::setxattr(