]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/onode-staged-tree: check the maximum tree height
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 2 Jun 2021 06:07:33 +0000 (14:07 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 11 Jun 2021 14:43:58 +0000 (22:43 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/fwd.h
src/crimson/os/seastore/onode_manager/staged-fltree/node.cc

index 2c08895320da6643bb1e568798cd9b7c8817e1ce..41ac86bea7ec0dcb45afaa0cec3430438e0d82ec 100644 (file)
@@ -52,6 +52,8 @@ using InternalNodeImplURef = std::unique_ptr<InternalNodeImpl>;
 using NodeImplURef = std::unique_ptr<NodeImpl>;
 
 using level_t = uint8_t;
+constexpr auto MAX_LEVEL = std::numeric_limits<level_t>::max();
+
 // a type only to index within a node, 32 bits should be enough
 using index_t = uint32_t;
 constexpr auto INDEX_END = std::numeric_limits<index_t>::max();
index d0f35817f59d8765948d14c24d6cd934cf2613a8..7f36e435cc9f2104ebff8d997a79f1a0ef2b1bdc 100644 (file)
@@ -1176,6 +1176,8 @@ eagain_future<Ref<InternalNode>> InternalNode::allocate_root(
     context_t c, level_t old_root_level,
     laddr_t old_root_addr, Super::URef&& super)
 {
+  // support tree height up to 256
+  ceph_assert(old_root_level < MAX_LEVEL);
   return InternalNode::allocate(c, field_type_t::N0, true, old_root_level + 1
   ).safe_then([c, old_root_addr,
                super = std::move(super)](auto fresh_node) mutable {