From: Kefu Chai Date: Thu, 18 Aug 2022 16:37:36 +0000 (+0800) Subject: crimson/os: make _node_fields_013_t::insert_at() use IsFullKey X-Git-Tag: v18.0.0~233^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47680%2Fhead;p=ceph.git crimson/os: make _node_fields_013_t::insert_at() use IsFullKey less repeatings this way Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc index 4252b4dcb1f4..f2a55e5fffdd 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc @@ -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(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); diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc index 561da24a33b6..a0752e0fc3bc 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.cc @@ -82,9 +82,9 @@ void F013_T::append_offset( } template -template +template void F013_T::insert_at( - NodeExtentMutable& mut, const full_key_t& 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(NodeExtentMutable&, const full_key_t&, \ + insert_at(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 node_offset_t F013_T::erase_at( diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h index 2ea7f215c98f..f65d628fd19d 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h @@ -182,9 +182,9 @@ struct _node_fields_013_t { } static node_offset_t estimate_insert_one() { return sizeof(SlotType); } - template + template static void insert_at( - NodeExtentMutable&, const full_key_t& 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( diff --git a/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc b/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc index fe7fc869c2d3..5f2cc000f935 100644 --- a/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc +++ b/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc @@ -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(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(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(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));