]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/onode-staged-tree: integrate seastore read/write_node_root()
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 21 Sep 2020 02:50:18 +0000 (10:50 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 1 Dec 2020 04:50:53 +0000 (12:50 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h

index e01cf4c534445d696b1d07e6afc156439e8acb90..c262489e7528536f08f5e24247509dcb0cee822c 100644 (file)
@@ -17,11 +17,8 @@ class SeastoreSuper final: public Super {
   laddr_t get_root_laddr() const override {
     return root_addr;
   }
-  void write_root_laddr(context_t c, laddr_t addr) override {
-    root_addr = addr;
-    //TODO
-    assert(false && "not implemented");
-  }
+  void write_root_laddr(context_t c, laddr_t addr) override;
+
   laddr_t root_addr;
   TransactionManager& tm;
 };
@@ -80,15 +77,21 @@ class SeastoreNodeExtentManager final: public NodeExtentManager {
   }
 
   tm_future<Super::URef> get_super(Transaction& t, RootNodeTracker& tracker) {
-    // TODO
-    return tm_ertr::make_ready_future<Super::URef>(
-        Super::URef(new SeastoreSuper(t, tracker, L_ADDR_NULL, tm)));
+    return tm.read_onode_root(t).safe_then([this, &t, &tracker](auto root_addr) {
+      return Super::URef(new SeastoreSuper(t, tracker, root_addr, tm));
+    });
   }
 
   TransactionManager& tm;
   const laddr_t addr_min;
 };
 
+inline void SeastoreSuper::write_root_laddr(context_t c, laddr_t addr) {
+  root_addr = addr;
+  auto nm = static_cast<SeastoreNodeExtentManager*>(&c.nm);
+  nm->get_tm().write_onode_root(c.t, addr);
+}
+
 inline NodeExtentRef SeastoreNodeExtent::mutate(context_t c) {
   auto nm = static_cast<SeastoreNodeExtentManager*>(&c.nm);
   auto ret = nm->get_tm().get_mutable_extent(c.t, this);