]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: adjust _clone to support omap tree for LOG
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 5 Dec 2024 05:21:36 +0000 (05:21 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 20 Feb 2025 12:28:14 +0000 (12:28 +0000)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/onode.h
src/crimson/os/seastore/seastore.cc

index a8d27aa4ee284488d16eccdf4ac4836a34042155..548239c6718972da130701606917eaf82f7dea25 100644 (file)
@@ -42,6 +42,17 @@ struct onode_layout_t {
 
   onode_layout_t() : omap_root(omap_type_t::OMAP), log_root(omap_type_t::LOG),
     xattr_root(omap_type_t::XATTR) {}
+
+  const omap_root_le_t& get_root(omap_type_t type) const {
+    if (type == omap_type_t::XATTR) {
+      return xattr_root;
+    } else if (type == omap_type_t::OMAP) {
+      return omap_root;
+    } else {
+      ceph_assert(type == omap_type_t::LOG);
+      return log_root;
+    }
+  }
 } __attribute__((packed));
 
 class Transaction;
index 0d0f777b4150c96d8d317c5b3fd68e5880fa58ef..4b753b974c92b4eaee10f93fffe2b9afcb729a74 100644 (file)
@@ -2177,13 +2177,11 @@ SeaStore::Shard::_clone_omaps(
       auto& layout = onode->get_layout();
       return omap_list(
        *onode,
-       otype == omap_type_t::XATTR
-         ? layout.xattr_root
-         : layout.omap_root,
+       layout.get_root(otype),
        *ctx.transaction,
        start,
        OMapManager::omap_list_config_t().with_inclusive(false, false)
-      ).si_then([&ctx, &onode, &d_onode, this, otype, &start](auto p) mutable {
+      ).si_then([&ctx, &d_onode, this, otype, &start](auto p) mutable {
        auto complete = std::get<0>(p);
        auto &attrs = std::get<1>(p);
        if (attrs.empty()) {
@@ -2197,9 +2195,7 @@ SeaStore::Shard::_clone_omaps(
          ctx,
          d_onode,
          std::map<std::string, ceph::bufferlist>(attrs.begin(), attrs.end()),
-         otype == omap_type_t::XATTR
-           ? d_onode->get_layout().xattr_root
-           : d_onode->get_layout().omap_root
+         d_onode->get_layout().get_root(otype)
        ).si_then([complete, nstart=std::move(nstart),
                  &start]() mutable {
          if (complete) {
@@ -2239,6 +2235,8 @@ SeaStore::Shard::_clone(
     return _clone_omaps(ctx, onode, d_onode, omap_type_t::XATTR);
   }).si_then([&ctx, &onode, &d_onode, this] {
     return _clone_omaps(ctx, onode, d_onode, omap_type_t::OMAP);
+  }).si_then([&ctx, &onode, &d_onode, this] {
+    return _clone_omaps(ctx, onode, d_onode, omap_type_t::LOG);
   });
 }