From: Samuel Just Date: Tue, 30 Sep 2025 17:52:45 +0000 (-0700) Subject: crimson/.../transaction_manager: introduce resolve_cursor_to_mapping X-Git-Tag: v21.0.0~99^2~50 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3579408ef6012db60cb3e40b4e9ebd1adcb9716f;p=ceph.git crimson/.../transaction_manager: introduce resolve_cursor_to_mapping Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc index a5fde3ae47a..e74c1b1c723 100644 --- a/src/crimson/os/seastore/transaction_manager.cc +++ b/src/crimson/os/seastore/transaction_manager.cc @@ -424,6 +424,43 @@ TransactionManager::_remove( } } +using resolve_cursor_to_mapping_iertr = base_iertr; +resolve_cursor_to_mapping_iertr::future +TransactionManager::resolve_cursor_to_mapping( + Transaction &t, + LBACursorRef cursor) +{ + LOG_PREFIX(TransactionManager::resolve_cursor_to_mapping); + co_await cursor->refresh(); + if (cursor->is_end() || !cursor->is_indirect()) { + auto ret = co_await LBAMapping::create_direct(cursor).refresh(); + DEBUGT("{} -> {}", t, *cursor, ret); + co_return ret; + } + + assert(cursor->get_refcount() == EXTENT_DEFAULT_REF_COUNT); + assert(cursor->get_checksum() == 0); + + auto direct_cursors = co_await lba_manager->get_cursors( + t, + cursor->get_intermediate_key(), + cursor->get_length() + ); + + ceph_assert(direct_cursors.size() == 1); + auto& direct_cursor = direct_cursors.front(); + auto intermediate_key = cursor->get_intermediate_key(); + assert(!direct_cursor->is_indirect()); + assert(direct_cursor->get_laddr() <= intermediate_key); + assert(direct_cursor->get_laddr() + direct_cursor->get_length() + >= intermediate_key + cursor->get_length()); + auto ret = co_await LBAMapping::create_indirect( + std::move(direct_cursor), + cursor).refresh(); + DEBUGT("{} -> {}", t, *cursor, ret); + co_return ret; +} + TransactionManager::refs_ret TransactionManager::remove( Transaction &t, std::vector offsets) diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index 3fdf27f9ac0..8c07a924260 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -1159,6 +1159,12 @@ private: return cache->can_drop_backref(); } + using resolve_cursor_to_mapping_iertr = base_iertr; + resolve_cursor_to_mapping_iertr::future + resolve_cursor_to_mapping( + Transaction &t, + LBACursorRef cursor); + using LBALeafNode = lba::LBALeafNode; struct unlinked_child_t { LBAMapping mapping;