From: Xuehan Xu Date: Thu, 20 Nov 2025 09:16:57 +0000 (+0800) Subject: crimson/os/seastore/cache: add facilities to synchronize data and states X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7b9c8474ce44e7d28708393ca268beeb2175906;p=ceph-ci.git crimson/os/seastore/cache: add facilities to synchronize data and states between rewriting trasactions and others when committing Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/common/fixed_kv_node_layout.h b/src/crimson/common/fixed_kv_node_layout.h index 6ec85fbe77a..fb8fc9bd177 100644 --- a/src/crimson/common/fixed_kv_node_layout.h +++ b/src/crimson/common/fixed_kv_node_layout.h @@ -365,7 +365,6 @@ public: virtual ~FixedKVNodeLayout() = default; void set_layout_buf(char *_buf) { - assert(buf == nullptr); assert(_buf != nullptr); buf = _buf; } diff --git a/src/crimson/os/seastore/btree/fixed_kv_node.h b/src/crimson/os/seastore/btree/fixed_kv_node.h index de57a482c14..8dcf1e9e68e 100644 --- a/src/crimson/os/seastore/btree/fixed_kv_node.h +++ b/src/crimson/os/seastore/btree/fixed_kv_node.h @@ -49,6 +49,10 @@ struct FixedKVNode : CachedExtent { virtual ~FixedKVNode() = default; virtual void do_on_rewrite(Transaction &t, CachedExtent &extent) = 0; + virtual void on_state_commit() override { + auto &prior = static_cast(*get_prior_instance()); + prior.range = std::move(range); + } bool is_in_range(const node_key_t key) const { return get_node_meta().is_in_range(key); } @@ -177,6 +181,10 @@ struct FixedKVInternalNode return this->get_split_pivot().get_offset(); } + void sync_layout_buf() { + this->set_layout_buf(this->get_bptr().c_str()); + } + void prepare_commit() final { parent_node_t::prepare_commit(); } @@ -199,6 +207,14 @@ struct FixedKVInternalNode } } + void on_data_commit() final { + auto &prior = static_cast(*this->get_prior_instance()); + if (this->is_mutation_pending()) { + prior.delta_buffer = std::move(delta_buffer); + } + prior.set_layout_buf(prior.get_bptr().c_str()); + } + void on_invalidated(Transaction &t) final { this->child_node_t::on_invalidated(); } @@ -483,6 +499,52 @@ struct FixedKVInternalNode assert(this->get_size() >= (get_min_capacity() - 1)); return this->get_size() < get_min_capacity(); } + + void reapply_delta() final { + if (delta_buffer.empty()) { + return; + } + delta_buffer.replay(*this); + } + + void merge_content_to_pending_versions(Transaction &t) { + ceph_assert(is_rewrite_transaction(t.get_src())); + this->for_each_copy_dest_set(t, [this, &t](auto ©_dests) { + this->merge_content_to(t, copy_dests.dests_by_key); + }); + } + + template