From: Samuel Just Date: Wed, 8 Oct 2025 02:23:00 +0000 (-0700) Subject: crimson/.../lba_manager: remove remove_mappings X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c6b94302f35a1ca1751a9d7a2fb498ddeae41e9f;p=ceph-ci.git crimson/.../lba_manager: remove remove_mappings Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/lba/btree_lba_manager.h b/src/crimson/os/seastore/lba/btree_lba_manager.h index 457fa7b6218..6cbd1bea525 100644 --- a/src/crimson/os/seastore/lba/btree_lba_manager.h +++ b/src/crimson/os/seastore/lba/btree_lba_manager.h @@ -215,60 +215,6 @@ public: }); } - ref_ret remove_mapping( - Transaction &t, - laddr_t addr) final { - auto result = co_await update_refcount(t, addr, -1); - ceph_assert(result.refcount == 0); - if (result.addr.is_paddr()) { - co_return ref_update_result_t{std::move(result), std::nullopt}; - } - - auto direct_result = co_await update_refcount(t, result.key, -1); - result.mapping = co_await result.mapping.refresh(); - co_return ref_update_result_t{ - std::move(result), - std::move(direct_result) - }; - } - - ref_ret remove_mapping( - Transaction &t, - LBAMapping mapping) final { - assert(mapping.is_viewable()); - assert(mapping.is_complete()); - return seastar::do_with( - std::move(mapping), - [&t, this](auto &mapping) { - auto &cursor = mapping.get_effective_cursor(); - return update_refcount(t, &cursor, -1 - ).si_then([this, &t, &mapping](auto res) { - ceph_assert(res.refcount == 0); - if (res.addr.is_paddr()) { - assert(!mapping.is_indirect()); - return ref_iertr::make_ready_future< - ref_update_result_t>(ref_update_result_t{ - std::move(res), std::nullopt}); - } - assert(mapping.is_indirect()); - auto &cursor = *mapping.direct_cursor; - return cursor.refresh().si_then([this, &t, &cursor] { - return update_refcount(t, &cursor, -1); - }).si_then([indirect_result=std::move(res)] - (auto direct_result) mutable { - return indirect_result.mapping.refresh( - ).si_then([direct_result=std::move(direct_result), - indirect_result=std::move(indirect_result)](auto) { - return ref_iertr::make_ready_future< - ref_update_result_t>(ref_update_result_t{ - std::move(indirect_result), - std::move(direct_result)}); - }); - }); - }); - }); - } - base_iertr::future update_mapping_refcount( Transaction &t, LBACursorRef cursor, diff --git a/src/crimson/os/seastore/lba_manager.h b/src/crimson/os/seastore/lba_manager.h index 19545016a30..62c1aa5186e 100644 --- a/src/crimson/os/seastore/lba_manager.h +++ b/src/crimson/os/seastore/lba_manager.h @@ -175,35 +175,8 @@ public: return refcount == 0 && addr.is_paddr() && !addr.get_paddr().is_zero(); } }; - struct ref_update_result_t { - mapping_update_result_t result; - std::optional direct_result; - }; using ref_iertr = base_iertr::extend< crimson::ct_error::enoent>; - using ref_ret = ref_iertr::future; - - /** - * Removes a mapping and deal with indirection - * - * @return returns the information about the removed - * mappings including the corresponding direct mapping - * if the mapping of laddr is indirect. - */ - virtual ref_ret remove_mapping( - Transaction &t, - laddr_t addr) = 0; - - /* - * Removes the mapping and deal with indirection - * - * @return returns the information about the removed - * mappings including the corresponding direct mapping - * if the mapping of laddr is indirect. - */ - virtual ref_ret remove_mapping( - Transaction &t, - LBAMapping mapping) = 0; /** * Update ref count on mapping diff --git a/src/test/crimson/seastore/test_btree_lba_manager.cc b/src/test/crimson/seastore/test_btree_lba_manager.cc index 53b3d74bd06..be870746b52 100644 --- a/src/test/crimson/seastore/test_btree_lba_manager.cc +++ b/src/test/crimson/seastore/test_btree_lba_manager.cc @@ -597,19 +597,24 @@ struct btree_lba_manager_test : btree_test_base { (void) with_trans_intr( *t.t, - [=, this](auto &t) { - return lba_manager->remove_mapping( + seastar::coroutine::lambda([=, this](auto &t) + -> LBAManager::ref_iertr::future<> { + + auto cursor = co_await lba_manager->get_cursor( t, - target->first - ).si_then([this, &t, target](auto result) { - EXPECT_EQ(result.result.refcount, target->second.refcount); - if (result.result.refcount == 0) { - return cache->retire_extent_addr( - t, result.result.addr.get_paddr(), result.result.length); - } - return Cache::retire_extent_iertr::now(); - }); - }).unsafe_get(); + target->first); + auto refcount = cursor->get_refcount() - 1; + co_await lba_manager->update_mapping_refcount( + t, + cursor, + -1 + ); + EXPECT_EQ(refcount, target->second.refcount); + if (refcount == 0) { + co_await cache->retire_extent_addr( + t, cursor->get_paddr(), cursor->get_length()); + } + })).unsafe_get(); if (target->second.refcount == 0) { t.mappings.erase(target); }