]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: make _node_fields_013_t::insert_at() use IsFullKey 47680/head
authorKefu Chai <tchaikov@gmail.com>
Thu, 18 Aug 2022 16:37:36 +0000 (00:37 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 18 Aug 2022 16:55:26 +0000 (00:55 +0800)
less repeatings this way

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc
src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc
src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h
src/test/crimson/seastore/onode_tree/test_staged_fltree.cc

index 4252b4dcb1f4274be214c28b2db86afb9d21532a..f2a55e5fffdda1dd5795501f2548c7ef16665ac2 100644 (file)
@@ -107,7 +107,7 @@ memory_range_t NODE_T::insert_prefix_at(
     const char* p_insert = node.p_start() +
                            node.fields().get_item_end_offset(index, mut.get_length());
     const char* p_insert_front = p_insert - size_right;
-    FieldType::template insert_at<KT>(mut, key, node.fields(), index, size_right);
+    FieldType::insert_at(mut, key, node.fields(), index, size_right);
     mut.shift_absolute(p_left_bound,
                        p_insert - p_left_bound,
                        -(int)size_right);
index 561da24a33b60acc676a8eb284c56fc12f76b701..a0752e0fc3bc689c5f7b9bfbc8cd30ec2b17f226 100644 (file)
@@ -82,9 +82,9 @@ void F013_T::append_offset(
 }
 
 template <typename SlotType>
-template <KeyT KT>
+template <IsFullKey Key>
 void F013_T::insert_at(
-    NodeExtentMutable& mut, const full_key_t<KT>& key,
+    NodeExtentMutable& mut, const Key& key,
     const me_t& node, index_t index, node_offset_t size_right)
 {
   assert(index <= node.num_keys);
@@ -103,14 +103,14 @@ void F013_T::insert_at(
   append_offset(mut, new_offset, p_insert);
 }
 #define IA_TEMPLATE(ST, KT) template void F013_INST(ST)::      \
-    insert_at<KT>(NodeExtentMutable&, const full_key_t<KT>&, \
+    insert_at<KT>(NodeExtentMutable&, const KT&, \
                   const F013_INST(ST)&, index_t, node_offset_t)
-IA_TEMPLATE(slot_0_t, KeyT::VIEW);
-IA_TEMPLATE(slot_1_t, KeyT::VIEW);
-IA_TEMPLATE(slot_3_t, KeyT::VIEW);
-IA_TEMPLATE(slot_0_t, KeyT::HOBJ);
-IA_TEMPLATE(slot_1_t, KeyT::HOBJ);
-IA_TEMPLATE(slot_3_t, KeyT::HOBJ);
+IA_TEMPLATE(slot_0_t, key_view_t);
+IA_TEMPLATE(slot_1_t, key_view_t);
+IA_TEMPLATE(slot_3_t, key_view_t);
+IA_TEMPLATE(slot_0_t, key_hobj_t);
+IA_TEMPLATE(slot_1_t, key_hobj_t);
+IA_TEMPLATE(slot_3_t, key_hobj_t);
 
 template <typename SlotType>
 node_offset_t F013_T::erase_at(
index 2ea7f215c98fe969c119f115fc98e0590348cbda..f65d628fd19dc2cc979a42edfaa7c627e6b00166 100644 (file)
@@ -182,9 +182,9 @@ struct _node_fields_013_t {
   }
 
   static node_offset_t estimate_insert_one() { return sizeof(SlotType); }
-  template <KeyT KT>
+  template <IsFullKey Key>
   static void insert_at(
-      NodeExtentMutable&, const full_key_t<KT>& key,
+      NodeExtentMutable&, const Key& key,
       const me_t& node, index_t index, node_offset_t size_right);
   static node_offset_t erase_at(NodeExtentMutable&, const me_t&, index_t, const char*);
   static void update_size_at(
index fe7fc869c2d3bfbafe6d2b5902a9d70e94be6156..5f2cc000f93569f76896c739d50ce62ca6e47f7a 100644 (file)
@@ -73,7 +73,7 @@ namespace {
     key_view_t key_view;
     char* p_fill = (char*)p_mem + key_size;
 
-    auto spc = shard_pool_crush_t::from_key<KeyT::HOBJ>(key_hobj);
+    auto spc = shard_pool_crush_t::from_key(key_hobj);
     p_fill -= sizeof(shard_pool_crush_t);
     std::memcpy(p_fill, &spc, sizeof(shard_pool_crush_t));
     key_view.set(*reinterpret_cast<const shard_pool_crush_t*>(p_fill));
@@ -83,7 +83,7 @@ namespace {
     ns_oid_view_t ns_oid_view(p_ns_oid);
     key_view.set(ns_oid_view);
 
-    auto sg = snap_gen_t::from_key<KeyT::HOBJ>(key_hobj);
+    auto sg = snap_gen_t::from_key(key_hobj);
     p_fill -= sizeof(snap_gen_t);
     ceph_assert(p_fill == (char*)p_mem);
     std::memcpy(p_fill, &sg, sizeof(snap_gen_t));