]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: reuse _omap_set_values() instead of _omap_set_kvs()
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 5 Dec 2024 03:53:22 +0000 (03:53 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 20 Feb 2025 12:28:04 +0000 (12:28 +0000)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/seastore.cc

index 97473bed5cbd74e58ad7e632063485df466da558..6be5d72f1d0be7cae32210c8620120a8f7e5c0f2 100644 (file)
@@ -2172,10 +2172,10 @@ SeaStore::Shard::_clone_omaps(
   OnodeRef &d_onode,
   const omap_type_t otype)
 {
-  return trans_intr::repeat([&ctx, onode, d_onode, this, otype] {
+  return trans_intr::repeat([&ctx, &onode, &d_onode, this, otype] {
     return seastar::do_with(
       std::optional<std::string>(std::nullopt),
-      [&ctx, onode, d_onode, this, otype](auto &start) {
+      [&ctx, &onode, &d_onode, this, otype](auto &start) {
       auto& layout = onode->get_layout();
       return omap_list(
        *onode,
@@ -2185,7 +2185,7 @@ SeaStore::Shard::_clone_omaps(
        *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, &onode, &d_onode, this, otype, &start](auto p) mutable {
        auto complete = std::get<0>(p);
        auto &attrs = std::get<1>(p);
        if (attrs.empty()) {
@@ -2195,23 +2195,15 @@ SeaStore::Shard::_clone_omaps(
              seastar::stop_iteration::yes);
        }
        std::string nstart = attrs.rbegin()->first;
-       return _omap_set_kvs(
+       return _omap_set_values(
+         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,
-         *ctx.transaction,
-         std::map<std::string, ceph::bufferlist>(attrs.begin(), attrs.end())
+           : d_onode->get_layout().omap_root
        ).si_then([complete, nstart=std::move(nstart),
-                 &start, &ctx, d_onode, otype](auto root) mutable {
-         if (root.must_update()) {
-           if (otype == omap_type_t::XATTR) {
-             d_onode->update_xattr_root(*ctx.transaction, root);
-           } else {
-             assert(otype == omap_type_t::OMAP);
-             d_onode->update_omap_root(*ctx.transaction, root);
-           }
-         }
+                 &start]() mutable {
          if (complete) {
            return seastar::make_ready_future<
              seastar::stop_iteration>(
@@ -2329,6 +2321,8 @@ SeaStore::Shard::_omap_set_values(
     if (root.must_update()) {
       if (root.get_type() == omap_type_t::OMAP) {
        onode->update_omap_root(*ctx.transaction, root);
+      } else if (root.get_type() == omap_type_t::XATTR) {
+       onode->update_xattr_root(*ctx.transaction, root);
       } else {
        ceph_assert(root.get_type() == omap_type_t::LOG);
        onode->update_log_root(*ctx.transaction, root);
@@ -2546,16 +2540,11 @@ SeaStore::Shard::_setattrs(
   DEBUGT("set attrs in omap", *ctx.transaction);
   return fut.si_then(
     [this, onode, &ctx, aset=std::move(aset)]() mutable {
-    return _omap_set_kvs(
+    return _omap_set_values(
+      ctx,
       onode,
-      onode->get_layout().xattr_root,
-      *ctx.transaction,
-      std::move(aset)
-    ).si_then([onode, &ctx](auto root) {
-      if (root.must_update()) {
-       onode->update_xattr_root(*ctx.transaction, root);
-      }
-    });
+      std::move(aset),
+      onode->get_layout().xattr_root);
   });
 }