]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/onode-staged-tree: declare and use max key indexes
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 29 Apr 2021 01:59:16 +0000 (09:59 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Sat, 8 May 2021 02:04:46 +0000 (10:04 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h
src/crimson/os/seastore/onode_manager/staged-fltree/tree_utils.h

index 47f6c9d7edf92014b9eebe4df456c827e95e3019..425c8cd59526bc909929a8a13107ba3bea3edba0 100644 (file)
@@ -25,6 +25,12 @@ static_assert(sizeof(crush_hash_t) == sizeof(ghobject_t().hobj.get_hash()));
 static_assert(sizeof(snap_t) == sizeof(ghobject_t().hobj.snap.val));
 static_assert(sizeof(gen_t) == sizeof(ghobject_t().generation));
 
+constexpr auto MAX_SHARD = std::numeric_limits<shard_t>::max();
+constexpr auto MAX_POOL = std::numeric_limits<pool_t>::max();
+constexpr auto MAX_CRUSH = std::numeric_limits<crush_hash_t>::max();
+constexpr auto MAX_SNAP = std::numeric_limits<snap_t>::max();
+constexpr auto MAX_GEN = std::numeric_limits<gen_t>::max();
+
 class NodeExtentMutable;
 class key_view_t;
 class key_hobj_t;
index 7d65b1a8cf9e65297f9491a0943dd7a0eb3e655f..016244ac383577dc744b7f5755cd4e390123f9be 100644 (file)
@@ -155,8 +155,8 @@ class KVPool {
       const std::pair<index_t, index_t>& range1,
       const std::pair<index_t, index_t>& range0) {
     ceph_assert(range2.first < range2.second);
-    ceph_assert(range2.second - 1 <= (index_t)std::numeric_limits<shard_t>::max());
-    ceph_assert(range2.second - 1 <= std::numeric_limits<crush_hash_t>::max());
+    ceph_assert(range2.second - 1 <= MAX_SHARD);
+    ceph_assert(range2.second - 1 <= MAX_CRUSH);
     ceph_assert(range1.first < range1.second);
     ceph_assert(range1.second - 1 <= 9);
     ceph_assert(range0.first < range0.second);