From: Samuel Just Date: Mon, 13 Oct 2025 20:13:33 +0000 (+0000) Subject: crimson/.../transaction_manager: convert get_extents_if_live and helpers to use cursors X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=67eeba534f4984819f724b012cc3bfe0434d3df5;p=ceph-ci.git crimson/.../transaction_manager: convert get_extents_if_live and helpers to use cursors Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc index b5669f6160c..60857e9373a 100644 --- a/src/crimson/os/seastore/transaction_manager.cc +++ b/src/crimson/os/seastore/transaction_manager.cc @@ -809,15 +809,16 @@ TransactionManager::get_extents_if_live( std::list 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", diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index 15aff3f3e31..365b37cb7ca 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -1178,15 +1178,14 @@ private: t, cursor.ctx.cache, cursor.pos, cursor.key); } - base_iertr::future read_pin_by_type( + base_iertr::future 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 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());