]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
fixup! crimson/os/seastore/cache: add facilities to synchronize data and states betwe...
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 11 Dec 2025 08:11:08 +0000 (16:11 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Tue, 10 Feb 2026 02:58:49 +0000 (10:58 +0800)
src/crimson/os/seastore/btree/fixed_kv_node.h
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cached_extent.cc
src/crimson/os/seastore/cached_extent.h
src/crimson/os/seastore/collection_manager/collection_flat_node.h
src/crimson/os/seastore/logical_child_node.h
src/crimson/os/seastore/transaction.h

index b11031a6ea194932a5c9e3b9569ba516b91278f8..fdd67e496561343faf8b93b6a263ebc6f0159273 100644 (file)
@@ -210,11 +210,7 @@ struct FixedKVInternalNode
   }
 
   void on_data_commit() final {
-    auto &prior = static_cast<this_type_t&>(*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());
+    this->set_layout_buf(this->get_bptr().c_str());
   }
 
   void on_invalidated(Transaction &t) final {
@@ -633,11 +629,7 @@ struct FixedKVLeafNode
   }
 
   void on_data_commit() final {
-    auto &prior = static_cast<this_type_t&>(*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());
+    this->set_layout_buf(this->get_bptr().c_str());
   }
 
   void sync_layout_buf() {
index ab891fc5747d117f268b1cac31af213d98509455..2ecfc5d6d46e8062ec60ce4866d95f722de9b854 100644 (file)
@@ -1962,9 +1962,9 @@ void Cache::complete_commit(
       committer.commit_and_share_paddr();
       if (is_lba_backref_node(i->get_type())) {
         committer.commit_data();
-        committer.share_prior_data_to_pending();
       }
       touch_extent_fully(prior, &t_src, t.get_cache_hint());
+      committer.sync_version();
       committer.unblock_trans(t);
       prior.complete_io();
       i->committer.reset();
@@ -2051,8 +2051,8 @@ void Cache::complete_commit(
       ceph_assert(prior.is_valid());
       if (is_lba_backref_node(i->get_type())) {
         committer.commit_data();
-        committer.share_prior_data_to_pending();
       }
+      committer.sync_version();
       prior.complete_io();
       prior.clear_delta();
       i->committer.reset();
index 3063c7cb01b24594e9eb643e61317e81e8b10ea8..d5abf2e085326f8075a4e7b2c159d548e31e42d3 100644 (file)
@@ -379,8 +379,11 @@ void ExtentCommitter::sync_checksum() {
 void ExtentCommitter::commit_data() {
   assert(extent.prior_instance);
   // extent and its prior are sharing the same bptr content
-  extent.prior_instance->set_bptr(extent.get_bptr());
-  extent.on_data_commit();
+  auto &prior = *extent.prior_instance;
+  prior.set_bptr(extent.get_bptr());
+  prior.on_data_commit();
+  _share_prior_data_to_mutations();
+  _share_prior_data_to_pending_versions();
 }
 
 void ExtentCommitter::commit_state() {
@@ -402,8 +405,6 @@ void ExtentCommitter::commit_state() {
   prior.version = extent.version;
   prior.user_hint = extent.user_hint;
   prior.rewrite_generation = extent.rewrite_generation;
-  prior.last_touch_end = extent.last_touch_end;
-  prior.cache_state = extent.cache_state;
   prior.state = extent.state;
   extent.on_state_commit();
 }
@@ -429,17 +430,22 @@ void ExtentCommitter::commit_and_share_paddr() {
 }
 
 void ExtentCommitter::_share_prior_data_to_mutations() {
+  LOG_PREFIX(ExtentCommitter::_share_prior_data_to_mutations);
+  ceph_assert(is_lba_backref_node(extent.get_type()));
   auto &prior = *extent.prior_instance;
   for (auto &mext : prior.mutation_pending_extents) {
     auto &mextent = static_cast<CachedExtent&>(mext);
+    TRACE("{} -> {}", extent, mextent);
     extent.get_bptr().copy_out(
       0, extent.get_length(), mextent.get_bptr().c_str());
+    mextent.on_data_commit();
     mextent.reapply_delta();
   }
 }
 
 void ExtentCommitter::_share_prior_data_to_pending_versions()
 {
+  ceph_assert(is_lba_backref_node(extent.get_type()));
   auto &prior = *extent.prior_instance;
   switch (extent.get_type()) {
   case extent_types_t::LADDR_LEAF:
index 2cb3ebe4321a85a3eafb1e610067d57b8a15fe10..e53ce32b70727d91b7310ed1c2a7868154ad6dd3 100644 (file)
@@ -294,11 +294,6 @@ public:
 
   void sync_version();
 
-  void share_prior_data_to_pending() {
-    _share_prior_data_to_mutations();
-    _share_prior_data_to_pending_versions();
-  }
-
   void commit_and_share_paddr();
 
 private:
index 9f8cd53d70b5cb16a8d8533506633186c82482ed..a1c2c0ceb0fd9dbceaf819c4ced1e6b3afb41ccf 100644 (file)
@@ -107,12 +107,6 @@ struct CollectionNode : LogicalChildNode {
   coll_map_t decoded;
   delta_buffer_t delta_buffer;
 
-  void do_on_state_commit() final {
-    auto &prior = static_cast<CollectionNode&>(*get_prior_instance());
-    prior.delta_buffer = std::move(delta_buffer);
-    prior.decoded = std::move(decoded);
-  }
-
   CachedExtentRef duplicate_for_write(Transaction&) final {
     assert(delta_buffer.empty());
     return CachedExtentRef(new CollectionNode(*this));
index 092ee084a2e597cf3d9b11bd33b67e9fda5be107..e143e323755c0c99da6df8a0d907abe683c2360c 100644 (file)
@@ -136,6 +136,9 @@ protected:
     do_on_replace_prior(t);
   }
   virtual void do_on_replace_prior(Transaction &t) {}
+  void on_data_commit() final {
+    ceph_abort("impossible");
+  }
 };
 using LogicalChildNodeRef = TCachedExtentRef<LogicalChildNode>;
 } // namespace crimson::os::seastore
index 723c87eb66ddb166b79cb20d32a64fd5a5f6b734..9a119b3a3fd41a5e74af50f05398cf361a56ca9b 100644 (file)
@@ -411,7 +411,7 @@ public:
   std::pair<bool, bool> pre_stable_extent_paddr_mod(
     read_set_item_t<Transaction> &item)
   {
-    LOG_PREFIX(Transaction::sync_extent_state);
+    LOG_PREFIX(Transaction::pre_stable_extent_paddr_mod);
     SUBTRACET(seastore_t, "{}", *this, *item.ref);
 #ifndef NDEBUG
     auto [existed, it] = lookup_trans_from_read_extent(item.ref);