From bfc2abae90dc0cd2a3a0ef7b62006435b305f51d Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Thu, 16 May 2024 09:21:45 +0800 Subject: [PATCH] crimson/os/seastore/btree: drop FixedKVNode::child_pos_for_key() Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/btree/fixed_kv_node.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/crimson/os/seastore/btree/fixed_kv_node.h b/src/crimson/os/seastore/btree/fixed_kv_node.h index a64585a9402cf..79495cb35d129 100644 --- a/src/crimson/os/seastore/btree/fixed_kv_node.h +++ b/src/crimson/os/seastore/btree/fixed_kv_node.h @@ -281,7 +281,7 @@ struct FixedKVNode : ChildableCachedExtent { return c.cache.template get_extent_viewable_by_trans(c.trans, (T*)child); } else if (is_pending()) { auto &sparent = get_stable_for_key(key); - auto spos = sparent.child_pos_for_key(key); + auto spos = sparent.lower_bound_offset(key); auto child = sparent.children[spos]; if (is_valid_child_ptr(child)) { return c.cache.template get_extent_viewable_by_trans(c.trans, (T*)child); @@ -454,7 +454,6 @@ struct FixedKVNode : ChildableCachedExtent { virtual uint16_t lower_bound_offset(node_key_t) const = 0; virtual uint16_t upper_bound_offset(node_key_t) const = 0; - virtual uint16_t child_pos_for_key(node_key_t) const = 0; virtual bool validate_stable_children() = 0; @@ -687,13 +686,6 @@ struct FixedKVInternalNode return this->upper_bound(key).get_offset(); } - uint16_t child_pos_for_key(NODE_KEY key) const final { - auto it = this->upper_bound(key); - assert(it != this->begin()); - --it; - return it.get_offset(); - } - NODE_KEY get_key_from_idx(uint16_t idx) const final { return this->iter_idx(idx).get_key(); } @@ -1057,7 +1049,7 @@ struct FixedKVLeafNode } else if (this->is_pending()) { auto key = this->iter_idx(pos).get_key(); auto &sparent = this->get_stable_for_key(key); - auto spos = sparent.child_pos_for_key(key); + auto spos = sparent.lower_bound_offset(key); auto child = sparent.children[spos]; if (is_valid_child_ptr(child)) { ceph_assert(child->is_logical()); @@ -1147,10 +1139,6 @@ struct FixedKVLeafNode return this->upper_bound(key).get_offset(); } - uint16_t child_pos_for_key(NODE_KEY key) const final { - return lower_bound_offset(key); - } - NODE_KEY get_key_from_idx(uint16_t idx) const final { return this->iter_idx(idx).get_key(); } -- 2.39.5