]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/btree: drop FixedKVNode::child_pos_for_key() 58093/head
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 16 May 2024 01:21:45 +0000 (09:21 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 17 Jun 2024 15:34:09 +0000 (18:34 +0300)
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit bfc2abae90dc0cd2a3a0ef7b62006435b305f51d)

src/crimson/os/seastore/btree/fixed_kv_node.h

index a64585a9402cf237ce99a57909ff3819188627db..79495cb35d129607e6719f27cbb4cff897ccd592 100644 (file)
@@ -281,7 +281,7 @@ struct FixedKVNode : ChildableCachedExtent {
       return c.cache.template get_extent_viewable_by_trans<T>(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<T>(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();
   }