From 8663e849389448a90e769e264819191bbe5047d1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 24 Aug 2022 13:27:05 +0800 Subject: [PATCH] crimson/os: replace full_key_t with key_view_t and replace full_key_t with key_hobj_t. there is not need to have this indirection Signed-off-by: Kefu Chai --- .../onode_manager/staged-fltree/node_layout.h | 12 +++---- .../staged-fltree/stages/stage.h | 36 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h index 85487944ee314..783a0c6cc60c5 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h @@ -310,7 +310,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { eagain_ifuture rebuild_extent(context_t c) override { assert(!is_keys_empty()); - full_key_t first_index; + key_view_t first_index; stage_t::template get_slot( extent.read(), position_t::begin(), &first_index, nullptr); auto hint = first_index.get_hint(); @@ -520,7 +520,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { node_stage, key, history, index_key); #ifndef NDEBUG if (!result_raw.is_end()) { - full_key_t index; + key_view_t index; stage_t::template get_slot( node_stage, result_raw.position, &index, nullptr); assert(index == *index_key); @@ -533,7 +533,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { if (result_raw.is_end()) { assert(result_raw.mstat == MSTAT_END); } else { - full_key_t index; + key_view_t index; stage_t::template get_slot( node_stage, result_raw.position, &index, nullptr); assert_mstat(key, index, result_raw.mstat); @@ -593,7 +593,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { } validate_layout(); #ifndef NDEBUG - full_key_t index; + key_view_t index; get_slot(insert_pos, &index, nullptr); assert(index == key); #endif @@ -773,14 +773,14 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { p_value = extent.template split_insert_replayable( split_at, key, value, insert_pos, insert_stage, insert_size); #ifndef NDEBUG - full_key_t index; + key_view_t index; get_slot(_insert_pos, &index, nullptr); assert(index == key); #endif } else { SUBDEBUG(seastore_onode, "-- left trim ..."); #ifndef NDEBUG - full_key_t index; + key_view_t index; right_impl.get_slot(_insert_pos, &index, nullptr); assert(index == key); #endif diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h index 5129695b6447c..6ed05d7e1c1df 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h @@ -23,7 +23,7 @@ struct search_result_bs_t { }; template search_result_bs_t binary_search( - const full_key_t& key, + const key_hobj_t& key, index_t begin, index_t end, FGetKey&& f_get_key) { assert(begin <= end); while (begin < end) { @@ -85,8 +85,8 @@ inline bool matchable(field_type_t type, match_stat_t mstat) { } inline void assert_mstat( - const full_key_t& key, - const full_key_t& index, + const key_hobj_t& key, + const key_view_t& index, match_stat_t mstat) { assert(mstat >= MSTAT_MIN && mstat <= MSTAT_LT2); // key < index ... @@ -301,7 +301,7 @@ struct staged { ++_index; } // Note: possible to return an end iterator - MatchKindBS seek(const full_key_t& key, bool exclude_last) { + MatchKindBS seek(const key_hobj_t& key, bool exclude_last) { assert(!is_end()); assert(index() == 0); index_t end_index = container.keys(); @@ -620,7 +620,7 @@ struct staged { _is_end = true; } // Note: possible to return an end iterator - MatchKindBS seek(const full_key_t& key, bool exclude_last) { + MatchKindBS seek(const key_hobj_t& key, bool exclude_last) { assert(!is_end()); assert(index() == 0); do { @@ -932,7 +932,7 @@ struct staged { template static result_t smallest_result( - const iterator_t& iter, full_key_t* p_index_key) { + const iterator_t& iter, key_view_t* p_index_key) { static_assert(!IS_BOTTOM); assert(!iter.is_end()); auto nxt_container = iter.get_nxt_container(); @@ -951,8 +951,8 @@ struct staged { template static result_t nxt_lower_bound( - const full_key_t& key, iterator_t& iter, - MatchHistory& history, full_key_t* index_key) { + const key_hobj_t& key, iterator_t& iter, + MatchHistory& history, key_view_t* index_key) { static_assert(!IS_BOTTOM); assert(!iter.is_end()); auto nxt_container = iter.get_nxt_container(); @@ -976,7 +976,7 @@ struct staged { static void get_largest_slot( const container_t& container, // IN position_t* p_position, // OUT - full_key_t* p_index_key, // OUT + key_view_t* p_index_key, // OUT const value_t** pp_value) { // OUT auto iter = iterator_t(container); iter.seek_last(); @@ -1015,7 +1015,7 @@ struct staged { static void get_slot( const container_t& container, // IN const position_t& pos, // IN - full_key_t* p_index_key, // OUT + key_view_t* p_index_key, // OUT const value_t** pp_value) { // OUT auto iter = iterator_t(container); iter.seek_at(pos.index); @@ -1044,9 +1044,9 @@ struct staged { template static result_t lower_bound( const container_t& container, - const full_key_t& key, + const key_hobj_t& key, MatchHistory& history, - full_key_t* index_key = nullptr) { + key_view_t* index_key = nullptr) { bool exclude_last = false; if (history.get().has_value()) { if (*history.get() == MatchKindCMP::EQ) { @@ -1159,7 +1159,7 @@ struct staged { template > static std::enable_if_t evaluate_insert( - const container_t& container, const full_key_t& key, + const container_t& container, const key_view_t& key, const value_input_t& value, position_t& position, bool evaluate_last) { auto iter = iterator_t(container); auto& index = position.index; @@ -1259,7 +1259,7 @@ struct staged { template > static std::enable_if_t evaluate_insert( - const full_key_t& key, const value_config_t& value, + const key_hobj_t& key, const value_config_t& value, const MatchHistory& history, match_stat_t mstat, position_t& position) { match_stage_t insert_stage = STAGE_TOP; while (*history.get_by_stage(insert_stage) == MatchKindCMP::EQ) { @@ -1478,7 +1478,7 @@ struct staged { } static void get_stats(const container_t& container, node_stats_t& stats, - full_key_t& index_key) { + key_view_t& index_key) { auto iter = iterator_t(container); assert(!iter.is_end()); stats.size_overhead += iterator_t::header_size(); @@ -1513,7 +1513,7 @@ struct staged { static bool get_next_slot( const container_t& container, // IN position_t& pos, // IN&OUT - full_key_t* p_index_key, // OUT + key_view_t* p_index_key, // OUT const value_t** pp_value) { // OUT auto iter = iterator_t(container); assert(!iter.is_end()); @@ -1554,7 +1554,7 @@ struct staged { static void get_prev_slot( const container_t& container, // IN position_t& pos, // IN&OUT - full_key_t* p_index_key, // OUT + key_view_t* p_index_key, // OUT const value_t** pp_value) { // OUT assert(pos != position_t::begin()); assert(!pos.is_end()); @@ -2344,7 +2344,7 @@ struct staged { } static std::tuple evaluate_merge( - const full_key_t& left_pivot_index, + const key_view_t& left_pivot_index, const container_t& right_container) { auto r_iter = iterator_t(right_container); r_iter.seek_at(0); -- 2.39.5