From 7e951f3af19d76e5bf62d071feb76e4df3e87e5d Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 20 Aug 2022 14:54:51 +0800 Subject: [PATCH] crimson/os: avoid using KeyT in is_valid_key() and we don't need to specify KeyT when instantiating this template function. Signed-off-by: Kefu Chai --- .../onode_manager/staged-fltree/stages/key_layout.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h index edcf956d856ac..6ffbd6ecf387d 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h @@ -404,8 +404,8 @@ inline const ghobject_t _MAX_OID() { } // the valid key stored in tree should be in the range of (_MIN_OID, _MAX_OID) -template -bool is_valid_key(const full_key_t& key); +template +bool is_valid_key(const Key& key); /** * key_hobj_t @@ -478,7 +478,7 @@ class key_hobj_t { } bool is_valid() const { - return is_valid_key(*this); + return is_valid_key(*this); } static key_hobj_t decode(ceph::bufferlist::const_iterator& delta) { @@ -596,7 +596,7 @@ class key_view_t { } ghobject_t to_ghobj() const { - assert(is_valid_key(*this)); + assert(is_valid_key(*this)); return ghobject_t( shard_id_t(shard()), pool(), crush(), std::string(nspace()), std::string(oid()), snap(), gen()); @@ -811,8 +811,9 @@ std::strong_ordering operator<=>(const LHS& lhs, const RHS& rhs) noexcept { return lhs.gen() <=> rhs.gen(); } -template -bool is_valid_key(const full_key_t& key) { +template +bool is_valid_key(const Key& key) { + static_assert(IsFullKey); return (key > key_hobj_t(ghobject_t()) && key < key_hobj_t(ghobject_t::get_max())); } -- 2.39.5