]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: add omap_type_t to omap_context_t to allocate OMapLeafNode in...
authorMyoungwon Oh <ohmyoungwon@gmail.com>
Fri, 29 Nov 2024 07:14:30 +0000 (07:14 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 20 Feb 2025 12:27:52 +0000 (12:27 +0000)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/omap_manager/btree/btree_omap_manager.cc
src/crimson/os/seastore/omap_manager/btree/btree_omap_manager.h
src/crimson/os/seastore/omap_manager/btree/omap_btree_node.h
src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc

index 6b5a452ab920299b7782cc4bec9e41958a2fbd4d..ae197097c6506fe62ea9052c0d2a6ef1190f2522 100644 (file)
@@ -113,10 +113,11 @@ BtreeOMapManager::omap_get_value(
   LOG_PREFIX(BtreeOMapManager::omap_get_value);
   DEBUGT("key={}", t, key);
   return get_omap_root(
-    get_omap_context(t, omap_root.hint),
+    get_omap_context(t, omap_root),
     omap_root
   ).si_then([this, &t, &key, &omap_root](auto&& extent) {
-    return extent->get_value(get_omap_context(t, omap_root.hint), key);
+    return extent->get_value(
+      get_omap_context(t, omap_root), key);
   }).si_then([](auto &&e) {
     return omap_get_value_ret(
         interruptible::ready_future_marker{},
@@ -150,15 +151,17 @@ BtreeOMapManager::omap_set_key(
   LOG_PREFIX(BtreeOMapManager::omap_set_key);
   DEBUGT("{} -> {}", t, key, value);
   return get_omap_root(
-    get_omap_context(t, omap_root.hint),
+    get_omap_context(t, omap_root),
     omap_root
   ).si_then([this, &t, &key, &value, &omap_root](auto root) {
-    return root->insert(get_omap_context(t, omap_root.hint), key, value);
+    return root->insert(get_omap_context(
+      t, omap_root), key, value);
   }).si_then([this, &omap_root, &t](auto mresult) -> omap_set_key_ret {
     if (mresult.status == mutation_status_t::SUCCESS)
       return seastar::now();
     else if (mresult.status == mutation_status_t::WAS_SPLIT)
-      return handle_root_split(get_omap_context(t, omap_root.hint), omap_root, mresult);
+      return handle_root_split(
+       get_omap_context(t, omap_root), omap_root, mresult);
     else
       return seastar::now();
   });
@@ -173,19 +176,21 @@ BtreeOMapManager::omap_rm_key(
   LOG_PREFIX(BtreeOMapManager::omap_rm_key);
   DEBUGT("{}", t, key);
   return get_omap_root(
-    get_omap_context(t, omap_root.hint),
+    get_omap_context(t, omap_root),
     omap_root
   ).si_then([this, &t, &key, &omap_root](auto root) {
-    return root->rm_key(get_omap_context(t, omap_root.hint), key);
+    return root->rm_key(get_omap_context(t, omap_root), key);
   }).si_then([this, &omap_root, &t](auto mresult) -> omap_rm_key_ret {
     if (mresult.status == mutation_status_t::SUCCESS) {
       return seastar::now();
     } else if (mresult.status == mutation_status_t::WAS_SPLIT) {
-      return handle_root_split(get_omap_context(t, omap_root.hint), omap_root, mresult);
+      return handle_root_split(
+       get_omap_context(t, omap_root), omap_root, mresult);
     } else if (mresult.status == mutation_status_t::NEED_MERGE) {
       auto root = *(mresult.need_merge);
       if (root->get_node_size() == 1 && omap_root.depth != 1) {
-        return handle_root_merge(get_omap_context(t, omap_root.hint), omap_root, mresult);
+        return handle_root_merge(
+         get_omap_context(t, omap_root), omap_root, mresult);
       } else {
         return seastar::now(); 
       }
@@ -259,11 +264,11 @@ BtreeOMapManager::omap_list(
   }
 
   return get_omap_root(
-    get_omap_context(t, omap_root.hint),
+    get_omap_context(t, omap_root),
     omap_root
   ).si_then([this, config, &t, &first, &last, &omap_root](auto extent) {
     return extent->list(
-      get_omap_context(t, omap_root.hint),
+      get_omap_context(t, omap_root),
       first,
       last,
       config);
@@ -278,10 +283,10 @@ BtreeOMapManager::omap_clear(
   LOG_PREFIX(BtreeOMapManager::omap_clear);
   DEBUGT("{}", t, omap_root);
   return get_omap_root(
-    get_omap_context(t, omap_root.hint),
+    get_omap_context(t, omap_root),
     omap_root
   ).si_then([this, &t, &omap_root](auto extent) {
-    return extent->clear(get_omap_context(t, omap_root.hint));
+    return extent->clear(get_omap_context(t, omap_root));
   }).si_then([this, &omap_root, &t] {
     return tm.remove(
       t, omap_root.get_location()
index 5f70d565c1e58e9db899218bb015ae888d93a26e..03bd9a79914fabdab8a4422cf07c826e96ab59a8 100644 (file)
@@ -26,8 +26,9 @@ class BtreeOMapManager : public OMapManager {
   TransactionManager &tm;
 
   omap_context_t get_omap_context(
-    Transaction &t, laddr_t addr_min) {
-    return omap_context_t{tm, t, addr_min};
+    Transaction &t, const omap_root_t &omap_root) {
+    ceph_assert(omap_root.type < omap_type_t::NUM_TYPES);
+    return omap_context_t{tm, t, omap_root.hint, omap_root.type};
   }
 
   /* get_omap_root
index 7c2392731c0e8a02d0db16645c50265d20feb3a5..d9fa981c4da2c399d117ca6da04c16ef08d787af 100644 (file)
@@ -19,6 +19,7 @@ struct omap_context_t {
   TransactionManager &tm;
   Transaction &t;
   laddr_t hint;
+  omap_type_t type;
 };
 
 enum class mutation_status_t : uint8_t {
index 5ba964ee99a5219264e7dfe489df3c3872cf0e26..6fd9daff12869890feef95a077e43cf3e194aa35 100644 (file)
@@ -9,6 +9,7 @@
 #include "crimson/os/seastore/omap_manager/btree/omap_btree_node.h"
 #include "crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h"
 #include "seastar/core/thread.hh"
+#include "crimson/os/seastore/omap_manager/btree/btree_omap_manager.h"
 
 SET_SUBSYS(seastore_omap);
 
@@ -747,7 +748,8 @@ omap_load_extent(omap_context_t oc, laddr_t laddr, depth_t depth)
     });
   } else {
     return oc.tm.read_extent<OMapLeafNode>(
-        oc.t, laddr, OMAP_LEAF_BLOCK_SIZE
+        oc.t, laddr,
+       BtreeOMapManager::get_leaf_size(oc.type)
     ).handle_error_interruptible(
       omap_load_extent_iertr::pass_further{},
       crimson::ct_error::assert_all{ "Invalid error in omap_load_extent" }