X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fcrimson%2Fos%2Fseastore%2Fbtree%2Fbtree_range_pin.h;h=68188e9ff55022b91df5fd528b7120a51e871d04;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=fef89197fd9ec6238f0d217e45faa02babf63a2b;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/crimson/os/seastore/btree/btree_range_pin.h b/ceph/src/crimson/os/seastore/btree/btree_range_pin.h index fef89197f..68188e9ff 100644 --- a/ceph/src/crimson/os/seastore/btree/btree_range_pin.h +++ b/ceph/src/crimson/os/seastore/btree/btree_range_pin.h @@ -21,21 +21,6 @@ struct op_context_t { constexpr uint16_t MAX_FIXEDKVBTREE_DEPTH = 8; -template -struct min_max_t {}; - -template <> -struct min_max_t { - static constexpr laddr_t max = L_ADDR_MAX; - static constexpr laddr_t min = L_ADDR_MIN; -}; - -template <> -struct min_max_t { - static constexpr paddr_t max = P_ADDR_MAX; - static constexpr paddr_t min = P_ADDR_MIN; -}; - template struct fixed_kv_node_meta_t { bound_t begin = min_max_t::min; @@ -117,7 +102,7 @@ struct fixed_kv_node_meta_le_t { template class BtreeNodeMapping : public PhysicalNodeMapping { - +protected: op_context_t ctx; /** * parent @@ -127,11 +112,16 @@ class BtreeNodeMapping : public PhysicalNodeMapping { */ CachedExtentRef parent; - val_t value; - extent_len_t len; + pladdr_t value; + extent_len_t len = 0; fixed_kv_node_meta_t range; uint16_t pos = std::numeric_limits::max(); + virtual std::unique_ptr _duplicate(op_context_t) const = 0; + fixed_kv_node_meta_t _get_pin_range() const { + return range; + } + public: using val_type = val_t; BtreeNodeMapping(op_context_t ctx) : ctx(ctx) {} @@ -140,14 +130,14 @@ public: op_context_t ctx, CachedExtentRef parent, uint16_t pos, - val_t &value, + pladdr_t value, extent_len_t len, - fixed_kv_node_meta_t &&meta) + fixed_kv_node_meta_t meta) : ctx(ctx), parent(parent), value(value), len(len), - range(std::move(meta)), + range(meta), pos(pos) { if (!parent->is_pending()) { @@ -182,16 +172,20 @@ public: } val_t get_val() const final { - return value; + if constexpr (std::is_same_v) { + return value.get_paddr(); + } else { + static_assert(std::is_same_v); + return value.get_laddr(); + } } - key_t get_key() const final { + key_t get_key() const override { return range.begin; } PhysicalNodeMappingRef duplicate() const final { - auto ret = std::unique_ptr>( - new BtreeNodeMapping(ctx)); + auto ret = _duplicate(ctx); ret->range = range; ret->value = value; ret->parent = parent;