]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: improve is_logical() checks
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 19 Mar 2025 02:44:59 +0000 (10:44 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 21 Mar 2025 03:19:28 +0000 (11:19 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cached_extent.h
src/crimson/os/seastore/transaction_manager.h

index 0604982f7e871a008552f357894d39ccd0df5403..1bed954713b04988f33ae175559e8b6a6403b9a6 100644 (file)
@@ -403,6 +403,8 @@ public:
   virtual extent_types_t get_type() const = 0;
 
   virtual bool is_logical() const {
+    assert(!is_logical_type(get_type()));
+    assert(is_physical_type(get_type()));
     return false;
   }
 
@@ -1349,10 +1351,6 @@ public:
     ceph_assert(0 == "Should never happen for a placeholder");
   }
 
-  bool is_logical() const final {
-    return false;
-  }
-
   void on_rewrite(Transaction &, CachedExtent&, extent_len_t) final {}
 
   std::ostream &print_detail(std::ostream &out) const final {
@@ -1406,6 +1404,8 @@ public:
   }
 
   bool is_logical() const final {
+    assert(is_logical_type(get_type()));
+    assert(!is_physical_type(get_type()));
     return true;
   }
 
index fc7137dfe51869371389472845750304bec6afb5..5bb06b4d02a79b50a8fe2d7502837060525a185d 100644 (file)
@@ -1043,6 +1043,7 @@ private:
       partial_len,
       [&pref]
       (T &extent) mutable {
+       assert(extent.is_logical());
        assert(!extent.has_laddr());
        assert(!extent.has_been_invalidated());
        assert(!pref.has_been_invalidated());
@@ -1118,6 +1119,7 @@ private:
       direct_key,
       direct_length,
       [&pref](CachedExtent &extent) mutable {
+       assert(extent.is_logical());
        auto &lextent = static_cast<LogicalChildNode&>(extent);
        assert(!lextent.has_laddr());
        assert(!lextent.has_been_invalidated());