]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../transaction_manager: convert alloc_data_extents to coroutine
authorSamuel Just <sjust@redhat.com>
Fri, 10 Oct 2025 00:47:07 +0000 (00:47 +0000)
committerSamuel Just <sjust@redhat.com>
Mon, 5 Jan 2026 21:14:58 +0000 (13:14 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/transaction_manager.h

index 6b11731aeab4dd4a662d9453caed944c6de5ddc6..c307c88e4f145c6d043b310f58ed441ad489a4c3 100644 (file)
@@ -442,54 +442,43 @@ public:
     LOG_PREFIX(TransactionManager::alloc_data_extents);
     SUBDEBUGT(seastore_tm, "{} hint {}~0x{:x} phint={} ...",
               t, T::TYPE, laddr_hint, len, placement_hint);
-    return seastar::do_with(
-      cache->alloc_new_data_extents<T>(
-       t,
-       len,
-       placement_hint,
-       INIT_GENERATION),
-      [pos=std::move(pos), this, &t,
-      FNAME, laddr_hint](auto &exts) mutable {
-      // user must initialize the logical extent themselves
-      assert(is_user_transaction(t.get_src()));
-      for (auto& ext : exts) {
-       ext->set_seen_by_users();
-      }
-      if (pos) {
-       // laddr_hint is determined
-       auto off = laddr_hint;
-       for (auto &extent : exts) {
-         extent->set_laddr(off);
-         off = (off + extent->get_length()).checked_to_laddr();
-       }
-      }
-      auto fut = alloc_extents_iertr::make_ready_future<
-       std::vector<LBAMapping>>();
-      if (pos) {
-       fut = pos->refresh(
-       ).si_then([&t, &exts, this](auto pos) {
-         return lba_manager->alloc_extents(
-           t,
-           std::move(pos),
-           std::vector<LogicalChildNodeRef>(
-             exts.begin(), exts.end()));
-       });
-      } else {
-       fut = lba_manager->alloc_extents(
-         t,
-         laddr_hint,
-         std::vector<LogicalChildNodeRef>(
-           exts.begin(), exts.end()),
-         EXTENT_DEFAULT_REF_COUNT);
+    auto exts = cache->alloc_new_data_extents<T>(
+      t,
+      len,
+      placement_hint,
+      INIT_GENERATION);
+    // user must initialize the logical extent themselves
+    assert(is_user_transaction(t.get_src()));
+    for (auto& ext : exts) {
+      ext->set_seen_by_users();
+    }
+    if (pos) {
+      // laddr_hint is determined
+      auto off = laddr_hint;
+      for (auto &extent : exts) {
+       extent->set_laddr(off);
+       off = (off + extent->get_length()).checked_to_laddr();
       }
-      return fut.si_then([&exts, &t, FNAME](auto &&) mutable {
-       for (auto &ext : exts) {
-         SUBDEBUGT(seastore_tm, "allocated {}", t, *ext);
-       }
-       return alloc_extent_iertr::make_ready_future<
-         std::vector<TCachedExtentRef<T>>>(std::move(exts));
-      });
-    });
+    }
+    if (pos) {
+      auto npos = co_await pos->refresh();
+      co_await lba_manager->alloc_extents(
+       t,
+       std::move(npos),
+       std::vector<LogicalChildNodeRef>(
+         exts.begin(), exts.end()));
+    } else {
+      co_await lba_manager->alloc_extents(
+       t,
+       laddr_hint,
+       std::vector<LogicalChildNodeRef>(
+         exts.begin(), exts.end()),
+       EXTENT_DEFAULT_REF_COUNT);
+    }
+    for (auto &ext : exts) {
+      SUBDEBUGT(seastore_tm, "allocated {}", t, *ext);
+    }
+    co_return exts;
   }
 
   template <typename T>