]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: avoid using KeyT in is_valid_key()
authorKefu Chai <tchaikov@gmail.com>
Sat, 20 Aug 2022 06:54:51 +0000 (14:54 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 20 Aug 2022 07:43:27 +0000 (15:43 +0800)
and we don't need to specify KeyT when instantiating this template
function.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h

index edcf956d856acde347e10e90f630308dbe77c082..6ffbd6ecf387d6025663d2411d0c7ba6b672ed5b 100644 (file)
@@ -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 <KeyT KT>
-bool is_valid_key(const full_key_t<KT>& key);
+template <typename Key>
+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<KeyT::HOBJ>(*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<KeyT::VIEW>(*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 <KeyT KT>
-bool is_valid_key(const full_key_t<KT>& key) {
+template <typename Key>
+bool is_valid_key(const Key& key) {
+  static_assert(IsFullKey<Key>);
   return (key > key_hobj_t(ghobject_t()) &&
           key < key_hobj_t(ghobject_t::get_max()));
 }