From: Xuehan Xu Date: Tue, 14 Oct 2025 02:48:09 +0000 (+0800) Subject: crimson/os/seastore/async_cleaner: renew backref cursors when they are X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4acc1cb47cb06ca3c8ba1c54f8f7b3ecb2765c23;p=ceph.git crimson/os/seastore/async_cleaner: renew backref cursors when they are generated by backref retrieval transactions and used by reclaim transactions Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/os/seastore/async_cleaner.cc b/src/crimson/os/seastore/async_cleaner.cc index b3c460173c9..927e27f41a9 100644 --- a/src/crimson/os/seastore/async_cleaner.cc +++ b/src/crimson/os/seastore/async_cleaner.cc @@ -1154,7 +1154,7 @@ using do_reclaim_space_ertr = base_ertr; using do_reclaim_space_ret = do_reclaim_space_ertr::future<>; do_reclaim_space_ret do_reclaim_space( const std::vector &backref_extents, - const backref_mapping_list_t &pin_list, + backref_mapping_list_t &pin_list, std::size_t &reclaimed, std::size_t &runs, ExtentCallbackInterface &extent_callback, @@ -1215,6 +1215,7 @@ do_reclaim_space_ret do_reclaim_space( backref_manager.get_cached_backref_entries_in_range(start_pos, end_pos); backref_entry_query_set_t backref_entries; for (auto &pin : pin_list) { + pin.renew_cursor(t); backref_entries.emplace( pin.get_key(), pin.get_val(), diff --git a/src/crimson/os/seastore/backref/backref_tree_node.h b/src/crimson/os/seastore/backref/backref_tree_node.h index 2e331146425..f8e06129006 100644 --- a/src/crimson/os/seastore/backref/backref_tree_node.h +++ b/src/crimson/os/seastore/backref/backref_tree_node.h @@ -187,6 +187,17 @@ struct BackrefCursor : assert(!is_end()); return iter.get_val().type; } + + BackrefCursor* renew_cursor(Transaction &t) { + auto c = op_context_t{ctx.cache, t}; + t.maybe_add_to_read_set(parent); + return new BackrefCursor( + c, + std::move(parent), + modifications, + std::move(iter)); + } + }; using BackrefCursorRef = boost::intrusive_ptr; diff --git a/src/crimson/os/seastore/backref_mapping.h b/src/crimson/os/seastore/backref_mapping.h index 4702ba6095f..1d4e78e9b7e 100644 --- a/src/crimson/os/seastore/backref_mapping.h +++ b/src/crimson/os/seastore/backref_mapping.h @@ -54,6 +54,10 @@ public: assert(cursor); return cursor->get_type(); } + + void renew_cursor(Transaction &t) { + cursor.reset(cursor->renew_cursor(t)); + } }; using backref_mapping_list_t = std::list;