]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: reuse link_phy_tree_root_node()
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 7 Mar 2024 08:20:07 +0000 (16:20 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 8 Mar 2024 07:50:14 +0000 (15:50 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/root_block.cc

index dc928e81b0fa270e177f8a2369d8af08a315afd6..5b8e0ca5d1f8809a8e39cb8f0d2c421d02fe1c47 100644 (file)
@@ -10,16 +10,22 @@ namespace crimson::os::seastore {
 void RootBlock::on_replace_prior(Transaction &t) {
   if (!lba_root_node) {
     auto &prior = static_cast<RootBlock&>(*get_prior_instance());
-    lba_root_node = prior.lba_root_node;
-    if (lba_root_node) {
-      ((lba_manager::btree::LBANode*)lba_root_node)->root_block = this;
+    if (prior.lba_root_node) {
+      RootBlockRef this_ref = this;
+      link_phy_tree_root_node(
+        this_ref,
+        static_cast<lba_manager::btree::LBANode*>(prior.lba_root_node)
+      );
     }
   }
   if (!backref_root_node) {
     auto &prior = static_cast<RootBlock&>(*get_prior_instance());
-    backref_root_node = prior.backref_root_node;
-    if (backref_root_node) {
-      ((backref::BackrefNode*)backref_root_node)->root_block = this;
+    if (prior.backref_root_node) {
+      RootBlockRef this_ref = this;
+      link_phy_tree_root_node(
+        this_ref,
+        static_cast<backref::BackrefNode*>(prior.backref_root_node)
+      );
     }
   }
 }