@@ -311,8 +311,9 @@ class TransactionManager : public ExtentCallbackInterface {
311311 return std::move (extent);
312312 });
313313 } else {
314+ auto &r = std::get<0 >(ret);
314315 return this ->pin_to_extent <T>(
315- t, std::move (std::get< 0 >(ret) ),
316+ t, std::move (r. mapping ), std::move (r. child_pos ),
316317 direct_partial_off, partial_len,
317318 std::move (maybe_init));
318319 }
@@ -981,8 +982,13 @@ class TransactionManager : public ExtentCallbackInterface {
981982
982983 shard_stats_t & shard_stats;
983984
985+ using LBALeafNode = lba_manager::btree::LBALeafNode;
986+ struct unlinked_child_t {
987+ LBAMappingRef mapping;
988+ child_pos_t <LBALeafNode> child_pos;
989+ };
984990 template <typename T>
985- std::variant<LBAMappingRef , get_child_ifut<T>>
991+ std::variant<unlinked_child_t , get_child_ifut<T>>
986992 get_extent_if_linked (
987993 Transaction &t,
988994 LBAMappingRef pin)
@@ -1005,7 +1011,9 @@ class TransactionManager : public ExtentCallbackInterface {
10051011 return extent->template cast <T>();
10061012 });
10071013 } else {
1008- return pin;
1014+ return unlinked_child_t {
1015+ std::move (pin),
1016+ v.get_child_pos ()};
10091017 }
10101018 }
10111019
@@ -1027,7 +1035,7 @@ class TransactionManager : public ExtentCallbackInterface {
10271035 return ext;
10281036 });
10291037 } else {
1030- return pin_to_extent_by_type (t, std::move (pin), type);
1038+ return pin_to_extent_by_type (t, std::move (pin), v. get_child_pos (), type);
10311039 }
10321040 }
10331041
@@ -1059,6 +1067,7 @@ class TransactionManager : public ExtentCallbackInterface {
10591067 pin_to_extent_ret<T> pin_to_extent (
10601068 Transaction &t,
10611069 LBAMappingRef pin,
1070+ child_pos_t <LBALeafNode> child_pos,
10621071 extent_len_t direct_partial_off,
10631072 extent_len_t partial_len,
10641073 lextent_init_func_t <T> &&maybe_init) {
@@ -1083,14 +1092,15 @@ class TransactionManager : public ExtentCallbackInterface {
10831092 direct_length,
10841093 direct_partial_off,
10851094 partial_len,
1086- [&pref, maybe_init=std::move (maybe_init)]
1095+ [&pref, maybe_init=std::move (maybe_init),
1096+ child_pos=std::move (child_pos)]
10871097 (T &extent) mutable {
10881098 assert (extent.is_logical ());
10891099 assert (!extent.has_laddr ());
10901100 assert (!extent.has_been_invalidated ());
10911101 assert (!pref.has_been_invalidated ());
10921102 assert (pref.get_parent ());
1093- pref .link_child (&extent);
1103+ child_pos .link_child (&extent);
10941104 extent.maybe_set_intermediate_laddr (pref);
10951105 maybe_init (extent);
10961106 extent.set_seen_by_users ();
@@ -1140,6 +1150,7 @@ class TransactionManager : public ExtentCallbackInterface {
11401150 pin_to_extent_by_type_ret pin_to_extent_by_type (
11411151 Transaction &t,
11421152 LBAMappingRef pin,
1153+ child_pos_t <LBALeafNode> child_pos,
11431154 extent_types_t type)
11441155 {
11451156 LOG_PREFIX (TransactionManager::pin_to_extent_by_type);
@@ -1163,15 +1174,15 @@ class TransactionManager : public ExtentCallbackInterface {
11631174 pref.get_val (),
11641175 direct_key,
11651176 direct_length,
1166- [&pref](CachedExtent &extent) mutable {
1177+ [&pref, child_pos= std::move (child_pos) ](CachedExtent &extent) mutable {
11671178 assert (extent.is_logical ());
11681179 auto &lextent = static_cast <LogicalChildNode&>(extent);
11691180 assert (!lextent.has_laddr ());
11701181 assert (!lextent.has_been_invalidated ());
11711182 assert (!pref.has_been_invalidated ());
11721183 assert (pref.get_parent ());
11731184 assert (!pref.get_parent ()->is_pending ());
1174- pref .link_child (&lextent);
1185+ child_pos .link_child (&lextent);
11751186 lextent.maybe_set_intermediate_laddr (pref);
11761187 // No change to extent::seen_by_user because this path is only
11771188 // for background cleaning.
0 commit comments