]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: consolidate the static member CachedExtent::TYPE
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 9 Jul 2021 07:07:49 +0000 (15:07 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 14 Jul 2021 02:31:51 +0000 (10:31 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/collection_manager/collection_flat_node.h
src/crimson/os/seastore/lba_manager/btree/lba_btree_node_impl.h
src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc
src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.h
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h

index 05f926c909d3f248bffe3fee0007776e92b210c3..98ec57fef6b17fbea40aa40340d2dfb5992b898d 100644 (file)
@@ -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;
index a4bb529f18fa450cf55285337782221e7191970e..61942e339a64d956fe21a529a231b2a919da7d60 100644 (file)
@@ -78,7 +78,7 @@ struct LBAInternalNode
     LBANode(std::forward<T>(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<LBAInternalNode>();
     auto replacement_left = c.cache.alloc_new_extent<LBAInternalNode>(
       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>(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<LBALeafNode>();
     auto replacement_left = c.cache.alloc_new_extent<LBALeafNode>(
       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;
index edc9c0a51085b299a8bf538e0bcb40a9d2a39be2..ad8e468bb54a304f99e409665adbd252b4c0945f 100644 (file)
@@ -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<OMapInnerNode>(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<OMapLeafNode>(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<OMapLeafNode>(oc.t, L_ADDR_MIN, OMAP_BLOCK_SIZE, 2)
     .si_then([this, _right] (auto &&replacement_pair) {
index 0ae4d254e1a112824a48533116d759f8071ee3e9..05819217c5db5e5d50821c9c8a6dd18fad78d681 100644 (file)
@@ -36,8 +36,6 @@ struct OMapInnerNode
     OMapNode(std::forward<T>(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<size_t> 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>(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<size_t> 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 {
index deb873265e92f9f3c14d9a97c1d9526345107fe0..4418667345333776dfe171787c27debc97378f2f 100644 (file)
@@ -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;
 };