From: Yingxin Cheng Date: Fri, 9 Jul 2021 07:07:49 +0000 (+0800) Subject: crimson/os/seastore: consolidate the static member CachedExtent::TYPE X-Git-Tag: v17.1.0~1410^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33ef0c8049852c79134240b7e89cc375cab42108;p=ceph.git crimson/os/seastore: consolidate the static member CachedExtent::TYPE Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/collection_manager/collection_flat_node.h b/src/crimson/os/seastore/collection_manager/collection_flat_node.h index 05f926c909d3..98ec57fef6b1 100644 --- a/src/crimson/os/seastore/collection_manager/collection_flat_node.h +++ b/src/crimson/os/seastore/collection_manager/collection_flat_node.h @@ -173,8 +173,9 @@ struct CollectionNode copy_to_node(); } + static constexpr extent_types_t TYPE = extent_types_t::COLL_BLOCK; extent_types_t get_type() const final { - return type; + return TYPE; } std::ostream &print_detail_l(std::ostream &out) const final; diff --git a/src/crimson/os/seastore/lba_manager/btree/lba_btree_node_impl.h b/src/crimson/os/seastore/lba_manager/btree/lba_btree_node_impl.h index a4bb529f18fa..61942e339a64 100644 --- a/src/crimson/os/seastore/lba_manager/btree/lba_btree_node_impl.h +++ b/src/crimson/os/seastore/lba_manager/btree/lba_btree_node_impl.h @@ -78,7 +78,7 @@ struct LBAInternalNode LBANode(std::forward(t)...), FixedKVNodeLayout(get_bptr().c_str()) {} - static constexpr extent_types_t type = extent_types_t::LADDR_INTERNAL; + static constexpr extent_types_t TYPE = extent_types_t::LADDR_INTERNAL; lba_node_meta_t get_node_meta() const final { return get_meta(); } @@ -170,7 +170,7 @@ struct LBAInternalNode op_context_t c, LBANodeRef &_right, bool prefer_left) final { - ceph_assert(_right->get_type() == type); + ceph_assert(_right->get_type() == TYPE); auto &right = *_right->cast(); auto replacement_left = c.cache.alloc_new_extent( c.trans, LBA_BLOCK_SIZE); @@ -224,7 +224,7 @@ struct LBAInternalNode } extent_types_t get_type() const final { - return type; + return TYPE; } std::ostream &print_detail(std::ostream &out) const final; @@ -352,7 +352,7 @@ struct LBALeafNode LBANode(std::forward(t)...), FixedKVNodeLayout(get_bptr().c_str()) {} - static constexpr extent_types_t type = extent_types_t::LADDR_LEAF; + static constexpr extent_types_t TYPE = extent_types_t::LADDR_LEAF; lba_node_meta_t get_node_meta() const final { return get_meta(); } @@ -449,7 +449,7 @@ struct LBALeafNode op_context_t c, LBANodeRef &_right, bool prefer_left) final { - ceph_assert(_right->get_type() == type); + ceph_assert(_right->get_type() == TYPE); auto &right = *_right->cast(); auto replacement_left = c.cache.alloc_new_extent( c.trans, LBA_BLOCK_SIZE); @@ -521,7 +521,7 @@ struct LBALeafNode } extent_types_t get_type() const final { - return type; + return TYPE; } std::ostream &print_detail(std::ostream &out) const final; diff --git a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc index edc9c0a51085..ad8e468bb54a 100644 --- a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc +++ b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc @@ -294,7 +294,7 @@ OMapInnerNode::make_balanced_ret OMapInnerNode::make_balanced(omap_context_t oc, OMapNodeRef _right) { logger().debug("OMapInnerNode: {}", __func__); - ceph_assert(_right->get_type() == type); + ceph_assert(_right->get_type() == TYPE); return oc.tm.alloc_extents(oc.t, L_ADDR_MIN, OMAP_BLOCK_SIZE, 2) .si_then([this, _right] (auto &&replacement_pair){ auto replacement_left = replacement_pair.front(); @@ -567,7 +567,7 @@ OMapLeafNode::make_split_children(omap_context_t oc) OMapLeafNode::full_merge_ret OMapLeafNode::make_full_merge(omap_context_t oc, OMapNodeRef right) { - ceph_assert(right->get_type() == type); + ceph_assert(right->get_type() == TYPE); logger().debug("OMapLeafNode: {}", __func__); return oc.tm.alloc_extent(oc.t, L_ADDR_MIN, OMAP_BLOCK_SIZE) .si_then([this, right] (auto &&replacement) { @@ -581,7 +581,7 @@ OMapLeafNode::make_full_merge(omap_context_t oc, OMapNodeRef right) OMapLeafNode::make_balanced_ret OMapLeafNode::make_balanced(omap_context_t oc, OMapNodeRef _right) { - ceph_assert(_right->get_type() == type); + ceph_assert(_right->get_type() == TYPE); logger().debug("OMapLeafNode: {}", __func__); return oc.tm.alloc_extents(oc.t, L_ADDR_MIN, OMAP_BLOCK_SIZE, 2) .si_then([this, _right] (auto &&replacement_pair) { diff --git a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h index 0ae4d254e1a1..05819217c5db 100644 --- a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h +++ b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h @@ -36,8 +36,6 @@ struct OMapInnerNode OMapNode(std::forward(t)...), StringKVInnerNodeLayout(get_bptr().c_str()) {} - static constexpr extent_types_t type = extent_types_t::OMAP_INNER; - omap_node_meta_t get_node_meta() const final { return get_meta(); } bool extent_will_overflow(size_t ksize, std::optional vsize) const { return is_overflow(ksize); @@ -104,8 +102,9 @@ struct OMapInnerNode std::ostream &print_detail_l(std::ostream &out) const final; + static constexpr extent_types_t TYPE = extent_types_t::OMAP_INNER; extent_types_t get_type() const final { - return type; + return TYPE; } ceph::bufferlist get_delta() final { @@ -149,8 +148,6 @@ struct OMapLeafNode OMapNode(std::forward(t)...), StringKVLeafNodeLayout(get_bptr().c_str()) {} - static constexpr extent_types_t type = extent_types_t::OMAP_LEAF; - omap_node_meta_t get_node_meta() const final { return get_meta(); } bool extent_will_overflow( size_t ksize, std::optional vsize) const { @@ -202,8 +199,9 @@ struct OMapLeafNode omap_context_t oc, OMapNodeRef _right) final; + static constexpr extent_types_t TYPE = extent_types_t::OMAP_LEAF; extent_types_t get_type() const final { - return type; + return TYPE; } ceph::bufferlist get_delta() final { diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h index deb873265e92..441866734533 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h @@ -46,6 +46,12 @@ class SeastoreNodeExtent final: public NodeExtent { SeastoreNodeExtent(const SeastoreNodeExtent& other) : NodeExtent(other) {} ~SeastoreNodeExtent() override = default; + + constexpr static extent_types_t TYPE = extent_types_t::ONODE_BLOCK_STAGED; + extent_types_t get_type() const override { + return TYPE; + } + protected: NodeExtentRef mutate(context_t, DeltaRecorderURef&&) override; @@ -56,14 +62,12 @@ class SeastoreNodeExtent final: public NodeExtent { CachedExtentRef duplicate_for_write() override { return CachedExtentRef(new SeastoreNodeExtent(*this)); } - extent_types_t get_type() const override { - return extent_types_t::ONODE_BLOCK_STAGED; - } ceph::bufferlist get_delta() override { assert(recorder); return recorder->get_delta(); } void apply_delta(const ceph::bufferlist&) override; + private: DeltaRecorderURef recorder; };