]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/lba: don't update LBALeafNode::modifications when 69447/head
authorXuehan Xu <xuxuehan@qianxin.com>
Mon, 15 Jun 2026 02:43:36 +0000 (10:43 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Thu, 18 Jun 2026 09:07:20 +0000 (17:07 +0800)
updating the lba mapping for committing rewrite transactions

Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/os/seastore/backref/backref_tree_node.h
src/crimson/os/seastore/btree/fixed_kv_btree.h
src/crimson/os/seastore/btree/fixed_kv_node.h
src/crimson/os/seastore/lba/btree_lba_manager.cc
src/crimson/os/seastore/lba/lba_btree_node.cc
src/crimson/os/seastore/lba/lba_btree_node.h

index d8d5961a9ad2a26d0eb5b97184eca982a46022eb..8af8afaebe0e08a46a9e031535d87f4f7ac20623 100644 (file)
@@ -105,7 +105,8 @@ public:
 
   void update(
     const_iterator iter,
-    backref_map_val_t val) final {
+    backref_map_val_t val,
+    modification_t) final {
     return journal_update(
       iter,
       val,
index b701062610ab045b00a98573dbce9fbe5e4c3c31..fdfa31230abba51c60eec940f5c7c4860a192571 100644 (file)
 
 namespace crimson::os::seastore {
 
+enum modification_t {
+  USER_MODIFY,  // logical update (affects node state)
+  TRANS_SYNC    // synchronization-only update (should NOT count
+                // as modification and should avoid on_modify(),
+                // for example, BtreeLBAManager::update_paddr_sync
+                // does not change the logical mapping, only the
+                // physical location (paddr) of the same data, so
+                // TRANS_SYNC is used.
+};
+
 template <typename T>
 phy_tree_root_t& get_phy_tree_root(root_t& r);
 
@@ -1108,7 +1118,8 @@ public:
     op_context_t c,
     iterator iter,
     node_val_t val,
-    BaseChildNode<leaf_node_t, node_key_t> *child)
+    BaseChildNode<leaf_node_t, node_key_t> *child,
+    modification_t mod = modification_t::USER_MODIFY)
   {
     LOG_PREFIX(FixedKVBtree::update);
     SUBTRACET(
@@ -1116,6 +1127,9 @@ public:
       "update element at {}",
       c.trans,
       iter.is_end() ? min_max_t<node_key_t>::max : iter.get_key());
+    if (mod == modification_t::TRANS_SYNC) {
+      assert(child == nullptr);
+    }
     if (!iter.leaf.node->is_mutable()) {
       CachedExtentRef mut = c.cache.duplicate_for_write(
         c.trans, iter.leaf.node
@@ -1125,7 +1139,8 @@ public:
     ++(get_tree_stats<self_type>(c.trans).num_updates);
     iter.leaf.node->update(
       iter.leaf.node->iter_idx(iter.leaf.pos),
-      val);
+      val,
+      mod);
     if constexpr (std::is_base_of_v<
         ParentNode<leaf_node_t, node_key_t>, leaf_node_t>) {
       if (child) {
index 74e5d47af7bd4d1f81d84dcb96157150ab1a563d..24475157938adb9e47cf91cb8ede2aeab978e793 100644 (file)
@@ -729,7 +729,8 @@ struct FixedKVLeafNode
 
   virtual void update(
     internal_const_iterator_t iter,
-    VAL val) = 0;
+    VAL val,
+    modification_t mod) = 0;
   virtual internal_const_iterator_t insert(
     internal_const_iterator_t iter,
     NODE_KEY addr,
index 1558802eb71ebf538c3f923464fa6ccc7324fc6c..124aa1a4da207baf2800cef65b4edea1b7f06c5d 100644 (file)
@@ -1173,7 +1173,8 @@ void BtreeLBAManager::update_paddr_sync(
       cursor->get_refcount(),
       cursor->get_checksum(),
       cursor->get_extent_type()},
-    nullptr);
+    nullptr,
+    modification_t::TRANS_SYNC);
 }
 
 BtreeLBAManager::move_mapping_ret
index ed94290f72a7ac6a674f4a48725de3bbcd076285..1e819b032e54fb37ab16a019d80db85d4dbdca23 100644 (file)
@@ -46,13 +46,16 @@ void LBALeafNode::resolve_relative_addrs(paddr_t base)
 
 void LBALeafNode::update(
   internal_const_iterator_t iter,
-  lba_map_val_t val)
+  lba_map_val_t val,
+  modification_t mod)
 {
   LOG_PREFIX(LBALeafNode::update);
   SUBTRACE(seastore_fixedkv_tree, "trans.{}, pos {}",
     this->pending_for_transaction,
     iter.get_offset());
-  this->on_modify();
+  if (likely(mod == modification_t::USER_MODIFY)) {
+    this->on_modify();
+  }
   if (val.pladdr.is_paddr()) {
     val.pladdr = maybe_generate_relative(val.pladdr.get_paddr());
   }
index cabb652bebf8cc748450095a721f462341e2096e..92e2c333a53ab1a8c1b374c21faccc2dd6f0ec15 100644 (file)
@@ -141,7 +141,8 @@ struct LBALeafNode
 
   void update(
     internal_const_iterator_t iter,
-    lba_map_val_t val) final;
+    lba_map_val_t val,
+    modification_t mod) final;
 
   internal_const_iterator_t insert(
     internal_const_iterator_t iter,