}
}
+ CachedExtentRef get_extent_viewable_by_trans_sync(
+ Transaction &t,
+ CachedExtentRef extent) final {
+ assert(extent->is_valid());
+
+ CachedExtent* p_extent = nullptr;
+ if (extent->is_stable()) {
+ p_extent = extent->maybe_get_transactional_view(t);
+ ceph_assert(p_extent);
+ if (p_extent != extent.get()) {
+ assert(p_extent->is_pending_in_trans(t.get_trans_id()));
+ assert(!p_extent->is_pending_io());
+ if (p_extent->is_mutable()) {
+ assert(p_extent->is_fully_loaded());
+ assert(!p_extent->is_pending_io());
+ } else {
+ assert(p_extent->is_exist_clean());
+ }
+ } else {
+ // stable from trans-view
+ assert(!p_extent->is_pending_in_trans(t.get_trans_id()));
+ }
+ } else {
+ assert(!extent->is_pending_io() || extent->is_exist_clean());
+ assert(extent->is_pending_in_trans(t.get_trans_id()));
+ if (extent->is_mutable()) {
+ assert(extent->is_fully_loaded());
+ } else {
+ assert(extent->is_exist_clean());
+ }
+ p_extent = extent.get();
+ }
+ return p_extent;
+ }
+
get_extent_iertr::future<CachedExtentRef>
get_extent_viewable_by_trans(
Transaction &t,
return ext->template cast<T>();
});
}
+ virtual CachedExtentRef get_extent_viewable_by_trans_sync(
+ Transaction &t,
+ CachedExtentRef extent) = 0;
virtual get_child_iertr::future<> maybe_wait_accessible(
Transaction &, CachedExtent&) = 0;
virtual CachedExtentRef peek_extent_viewable_by_trans(
btreenode_pos_t pos,
node_key_t key)
{
+ auto &me = down_cast();
assert(children.capacity());
assert(key == down_cast().iter_idx(pos).get_key());
auto child = children[pos];
ceph_assert(!is_reserved_ptr(child));
- assert(is_valid_child_ptr(child));
- return static_cast<ChildT*>(child);
+ if (is_valid_child_ptr(child)) {
+ auto ret = etvr.get_extent_viewable_by_trans_sync(
+ t, static_cast<ChildT*>(child));
+ return ret->template cast<ChildT>();
+ } else {
+ assert(me.is_pending());
+ auto &sparent = me.get_stable_for_key(key);
+ auto spos = sparent.lower_bound(key).get_offset();
+ child = sparent.children[spos];
+ assert(is_valid_child_ptr(child));
+ auto ret = etvr.get_extent_viewable_by_trans_sync(
+ t, static_cast<ChildT*>(child));
+ return ret->template cast<ChildT>();
+ }
}
template <typename ChildT>