@@ -226,27 +226,24 @@ struct FixedKVNode : ChildableCachedExtent {
226226 set_child_ptracker (child);
227227 }
228228
229- virtual get_child_ret_t <LogicalCachedExtent>
230- get_logical_child (op_context_t <node_key_t > c, uint16_t pos) = 0;
231-
232229 virtual bool is_child_stable (op_context_t <node_key_t >, uint16_t pos) const = 0;
233230
234- template <typename T, typename iter_t >
235- get_child_ret_t <T> get_child (op_context_t <node_key_t > c, iter_t iter) {
236- auto pos = iter.get_offset ();
231+ template <typename T>
232+ get_child_ret_t <T> get_child (
233+ op_context_t <node_key_t > c,
234+ uint16_t pos,
235+ node_key_t key)
236+ {
237237 assert (children.capacity ());
238238 auto child = children[pos];
239239 ceph_assert (!is_reserved_ptr (child));
240240 if (is_valid_child_ptr (child)) {
241- ceph_assert (child->get_type () == T::TYPE);
242241 return c.cache .template get_extent_viewable_by_trans <T>(c.trans , (T*)child);
243242 } else if (is_pending ()) {
244- auto key = iter.get_key ();
245243 auto &sparent = get_stable_for_key (key);
246244 auto spos = sparent.child_pos_for_key (key);
247245 auto child = sparent.children [spos];
248246 if (is_valid_child_ptr (child)) {
249- ceph_assert (child->get_type () == T::TYPE);
250247 return c.cache .template get_extent_viewable_by_trans <T>(c.trans , (T*)child);
251248 } else {
252249 return child_pos_t (&sparent, spos);
@@ -256,6 +253,11 @@ struct FixedKVNode : ChildableCachedExtent {
256253 }
257254 }
258255
256+ template <typename T, typename iter_t >
257+ get_child_ret_t <T> get_child (op_context_t <node_key_t > c, iter_t iter) {
258+ return get_child<T>(c, iter.get_offset (), iter.get_key ());
259+ }
260+
259261 void split_child_ptrs (
260262 FixedKVNode &left,
261263 FixedKVNode &right)
@@ -591,12 +593,6 @@ struct FixedKVInternalNode
591593 }
592594 }
593595
594- get_child_ret_t <LogicalCachedExtent>
595- get_logical_child (op_context_t <NODE_KEY>, uint16_t pos) final {
596- ceph_abort (" impossible" );
597- return get_child_ret_t <LogicalCachedExtent>(child_pos_t (nullptr , 0 ));
598- }
599-
600596 bool is_child_stable (op_context_t <NODE_KEY>, uint16_t pos) const final {
601597 ceph_abort (" impossible" );
602598 return false ;
@@ -970,31 +966,6 @@ struct FixedKVLeafNode
970966 return this ->get_split_pivot ().get_offset ();
971967 }
972968
973- get_child_ret_t <LogicalCachedExtent>
974- get_logical_child (op_context_t <NODE_KEY> c, uint16_t pos) final {
975- auto child = this ->children [pos];
976- ceph_assert (!is_reserved_ptr (child));
977- if (is_valid_child_ptr (child)) {
978- ceph_assert (child->is_logical ());
979- return c.cache .template get_extent_viewable_by_trans <
980- LogicalCachedExtent>(c.trans , (LogicalCachedExtent*)child);
981- } else if (this ->is_pending ()) {
982- auto key = this ->iter_idx (pos).get_key ();
983- auto &sparent = this ->get_stable_for_key (key);
984- auto spos = sparent.child_pos_for_key (key);
985- auto child = sparent.children [spos];
986- if (is_valid_child_ptr (child)) {
987- ceph_assert (child->is_logical ());
988- return c.cache .template get_extent_viewable_by_trans <
989- LogicalCachedExtent>(c.trans , (LogicalCachedExtent*)child);
990- } else {
991- return child_pos_t (&sparent, spos);
992- }
993- } else {
994- return child_pos_t (this , pos);
995- }
996- }
997-
998969 // children are considered stable if any of the following case is true:
999970 // 1. The child extent is absent in cache
1000971 // 2. The child extent is stable
0 commit comments