]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../btree_lba_manager: convert reserve_region to coroutine
authorSamuel Just <sjust@redhat.com>
Thu, 9 Oct 2025 23:16:14 +0000 (23:16 +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/lba/btree_lba_manager.cc
src/crimson/os/seastore/lba/btree_lba_manager.h

index abca34ae0e72787c399c268327d648eb55bf90aa..12cc8c9ba7115880bb7edc051098331a69bdb4ef 100644 (file)
@@ -349,25 +349,19 @@ BtreeLBAManager::reserve_region(
   DEBUGT("{} {}~{}", t, pos, addr, len);
   assert(pos.is_viewable());
   auto c = get_context(t);
-  return with_btree<LBABtree>(
-    cache,
-    c,
-    [pos=std::move(pos), c, addr, len](auto &btree) mutable {
-    auto &cursor = pos.get_effective_cursor();
-    auto iter = btree.make_partial_iter(c, cursor);
-    lba_map_val_t val{len, P_ADDR_ZERO, EXTENT_DEFAULT_REF_COUNT, 0};
-    return btree.insert(c, iter, addr, val
-    ).si_then([c](auto p) {
-      auto &[iter, inserted] = p;
-      ceph_assert(inserted);
-      auto &leaf_node = *iter.get_leaf_node();
-      leaf_node.insert_child_ptr(
-       iter.get_leaf_pos(),
-       get_reserved_ptr<LBALeafNode, laddr_t>(),
-       leaf_node.get_size() - 1 /*the size before the insert*/);
-      return LBAMapping::create_direct(iter.get_cursor(c));
-    });
-  });
+  auto btree = co_await get_btree<LBABtree>(cache, c);
+  auto &cursor = pos.get_effective_cursor();
+  auto iter = btree.make_partial_iter(c, cursor);
+  lba_map_val_t val{len, P_ADDR_ZERO, EXTENT_DEFAULT_REF_COUNT, 0};
+  auto p = co_await btree.insert(c, iter, addr, val);
+  ceph_assert(p.second);
+  iter = p.first;
+  auto &leaf_node = *iter.get_leaf_node();
+  leaf_node.insert_child_ptr(
+    iter.get_leaf_pos(),
+    get_reserved_ptr<LBALeafNode, laddr_t>(),
+    leaf_node.get_size() - 1 /*the size before the insert*/);
+  co_return LBAMapping::create_direct(iter.get_cursor(c));
 }
 
 BtreeLBAManager::alloc_extents_ret
index 4819b24f44428cad6f4d1d87fc89c387ea753dd7..e6e00dc3617bae1f9c0b08135ff586168cb25d88 100644 (file)
@@ -101,16 +101,10 @@ public:
   {
     std::vector<alloc_mapping_info_t> alloc_infos = {
       alloc_mapping_info_t::create_zero(len)};
-    return seastar::do_with(
-      std::move(alloc_infos),
-      [&t, hint, this](auto &alloc_infos) {
-      return alloc_contiguous_mappings(
-       t, hint, alloc_infos, alloc_policy_t::linear_search
-      ).si_then([](auto cursors) {
-       assert(cursors.size() == 1);
-       return LBAMapping::create_direct(std::move(cursors.front()));
-      });
-    });
+    auto cursors = co_await alloc_contiguous_mappings(
+      t, hint, alloc_infos, alloc_policy_t::linear_search);
+    assert(cursors.size() == 1);
+    co_return LBAMapping::create_direct(std::move(cursors.front()));
   }
 
   clone_mapping_ret clone_mapping(