]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../transaction_manager: convert get_extents_if_live and helpers to use cursors
authorSamuel Just <sjust@redhat.com>
Mon, 13 Oct 2025 20:13:33 +0000 (20:13 +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.cc
src/crimson/os/seastore/transaction_manager.h

index b5669f6160c0d874fc5c2cc874cc0e9a3181fb6e..60857e9373add935f71ae2c6759d2ebd3e263ee9 100644 (file)
@@ -809,15 +809,16 @@ TransactionManager::get_extents_if_live(
     std::list<CachedExtentRef> res;
     res.emplace_back(std::move(extent));
   } else if (is_logical_type(type)) {
-    auto pin_list = co_await lba_manager->get_mappings(
+    auto pin_list = co_await lba_manager->get_cursors(
       t,
       laddr,
       len
     );
     auto paddr_seg_id = paddr.as_seg_paddr().get_segment_id();
     for (auto &pin : pin_list) {
-      DEBUGT("got pin, try read in parallel ... -- {}", t, pin);
-      auto pin_paddr = pin.get_val();
+      ceph_assert(pin->is_direct());
+      DEBUGT("got pin, try read in parallel ... -- {}", t, *pin);
+      auto pin_paddr = pin->get_paddr();
       if (!pin_paddr.is_absolute_segmented()) {
        continue;
       }
@@ -843,7 +844,7 @@ TransactionManager::get_extents_if_live(
       //        recognize committed segments: https://tracker.ceph.com/issues/66941
       // ceph_assert(pin_seg_paddr >= paddr &&
       //             pin_seg_paddr.add_offset(pin_len) <= paddr.add_offset(len));
-      auto ret = co_await read_pin_by_type(t, std::move(pin), type);
+      auto ret = co_await read_cursor_by_type(t, std::move(pin), type);
       res.emplace_back(std::move(ret));
     }
     DEBUGT("{} {}~0x{:x} {} is alive as {} extents",
index 15aff3f3e31e589c6aa5d73b4a2671291d5328a8..365b37cb7ca845d9383c1e22b8c1ab534f09f299 100644 (file)
@@ -1178,15 +1178,14 @@ private:
       t, cursor.ctx.cache, cursor.pos, cursor.key);
   }
 
-  base_iertr::future<LogicalChildNodeRef> read_pin_by_type(
+  base_iertr::future<LogicalChildNodeRef> read_cursor_by_type(
     Transaction &t,
-    LBAMapping pin,
+    LBACursorRef cursor,
     extent_types_t type)
   {
-    ceph_assert(pin.is_viewable());
-    assert(!pin.is_indirect());
+    assert(cursor->is_direct());
     // Note: pin might be a clone
-    auto v = pin.get_logical_extent(t);
+    auto v = get_extent_if_linked(t, *cursor);
     // checking the lba child must be atomic with creating
     // and linking the absent child
     if (v.has_child()) {
@@ -1197,8 +1196,8 @@ private:
       ceph_assert(ext->get_type() == type);
       co_return ext;
     } else {
-      auto extent = co_await pin_to_extent_by_type(
-       t, pin, v.get_child_pos(), type);
+      auto extent = co_await cursor_to_extent_by_type(
+       t, cursor, v.get_child_pos(), type);
       co_return extent;
     }
   }
@@ -1440,30 +1439,30 @@ private:
   }
 
   /**
-   * pin_to_extent_by_type
+   * cursor_to_extent_by_type
    *
-   * Get extent mapped at pin.
+   * Get extent mapped at cursor.
    */
-  using pin_to_extent_by_type_ret = pin_to_extent_iertr::future<
+  using cursor_to_extent_by_type_ret = pin_to_extent_iertr::future<
     LogicalChildNodeRef>;
-  pin_to_extent_by_type_ret pin_to_extent_by_type(
+  cursor_to_extent_by_type_ret cursor_to_extent_by_type(
       Transaction &t,
-      LBAMapping pin,
+      LBACursorRef cursor,
       child_pos_t<LBALeafNode> child_pos,
       extent_types_t type)
   {
-    LOG_PREFIX(TransactionManager::pin_to_extent_by_type);
-    SUBTRACET(seastore_tm, "getting absent extent from pin {} type {} ...",
-              t, pin, type);
-    assert(pin.is_viewable());
+    LOG_PREFIX(TransactionManager::cursor_to_extent_by_type);
+    SUBTRACET(seastore_tm, "getting absent extent from cursor {} type {} ...",
+              t, *cursor, type);
     assert(is_logical_type(type));
     assert(is_background_transaction(t.get_src()));
-    laddr_t direct_key = pin.get_intermediate_base();
-    extent_len_t direct_length = pin.get_intermediate_length();
+    ceph_assert(cursor->is_direct());
+    laddr_t direct_key = cursor->get_laddr();
+    extent_len_t direct_length = cursor->get_length();
     auto ref = co_await cache->get_absent_extent_by_type(
       t,
       type,
-      pin.get_val(),
+      cursor->get_paddr(),
       direct_key,
       direct_length,
       // extent_init_func
@@ -1481,7 +1480,7 @@ private:
         // for background cleaning.
       }
     ),
-    pin.get_checksum());
+    cursor->get_checksum());
     SUBDEBUGT(seastore_tm, "got extent -- {} fully_loaded: {}",
               t, *ref, ref->is_fully_loaded());
     assert(ref->is_fully_loaded());