]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/transaction_manager: wire up collection_manager root
authorSamuel Just <sjust@redhat.com>
Tue, 26 Jan 2021 00:13:46 +0000 (16:13 -0800)
committerSamuel Just <sjust@redhat.com>
Wed, 24 Feb 2021 02:43:39 +0000 (18:43 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/root_block.h
src/crimson/os/seastore/transaction_manager.h

index 4a5024caa62f1a8e43e0ab1102537f35f981a681..1e8ba9f5de886d534c08d1252be2d7a11ffa013e 100644 (file)
@@ -19,6 +19,7 @@ struct __attribute__((aligned(8), packed)) root_t {
   paddr_t lba_root_addr;
   paddr_t segment_root;
   laddr_t onode_root = L_ADDR_NULL;
+  laddr_t collection_root = L_ADDR_NULL;
 
   void adjust_addrs_from_base(paddr_t base) {
     if (lba_root_addr.is_relative()) {
index 0bfc9d6e2b589f3a86add6d3f5b60d13bf156c3f..c978ed5a1e709b3703fb0c2e4bba6ae405f1c51d 100644 (file)
@@ -323,7 +323,7 @@ public:
    *
    * Get onode-tree root logical address
    */
-  using read_onode_root_ertr = read_extent_ertr;
+  using read_onode_root_ertr = base_ertr;
   using read_onode_root_ret = read_onode_root_ertr::future<laddr_t>;
   read_onode_root_ret read_onode_root(Transaction &t) {
     return cache.get_root(t).safe_then([](auto croot) {
@@ -342,6 +342,30 @@ public:
     croot->get_root().onode_root = addr;
   }
 
+  /**
+   * read_collection_root
+   *
+   * Get collection root addr
+   */
+  using read_collection_root_ertr = base_ertr;
+  using read_collection_root_ret = read_collection_root_ertr::future<laddr_t>;
+  read_collection_root_ret read_collection_root(Transaction &t) {
+    return cache.get_root(t).safe_then([](auto croot) {
+      return croot->get_root().collection_root;
+    });
+  }
+
+  /**
+   * write_collection_root
+   *
+   * Update collection root addr
+   */
+  void write_collection_root(Transaction &t, laddr_t addr) {
+    auto croot = cache.get_root_fast(t);
+    croot = cache.duplicate_for_write(t, croot)->cast<RootBlock>();
+    croot->get_root().collection_root = addr;
+  }
+
   ~TransactionManager();
 
 private: