]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: add asserts
authorYingxin Cheng <yingxin.cheng@intel.com>
Tue, 27 Aug 2024 08:26:06 +0000 (16:26 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 2 Sep 2024 02:57:56 +0000 (10:57 +0800)
Currently, cached must be stable, and absent must be clean.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.h
src/crimson/os/seastore/cached_extent.h

index 8ee1b9fdab4220a6ddf67156f2da8d3122078683..647e146a3a5664a81d144c87e77392221fb0debf 100644 (file)
@@ -423,6 +423,10 @@ public:
     SUBTRACET(seastore_cache, "{} {}~{} is absent on t, query cache ...",
              t, T::TYPE, offset, length);
     auto f = [&t, this](CachedExtent &ext) {
+      // FIXME: assert(ext.is_stable_clean());
+      assert(ext.is_stable());
+      assert(T::TYPE == ext.get_type());
+
       t.add_to_read_set(CachedExtentRef(&ext));
       const auto t_src = t.get_src();
       touch_extent(ext, &t_src);
@@ -762,6 +766,9 @@ private:
     SUBTRACET(seastore_cache, "{} {}~{} {} is absent on t, query cache ...",
              t, type, offset, length, laddr);
     auto f = [&t, this](CachedExtent &ext) {
+      // FIXME: assert(ext.is_stable_clean());
+      assert(ext.is_stable());
+
       t.add_to_read_set(CachedExtentRef(&ext));
       const auto t_src = t.get_src();
       touch_extent(ext, &t_src);
@@ -1791,6 +1798,7 @@ private:
           !is_retired_placeholder_type(iter->get_type())) {
         ++p_counters->hit;
       }
+      assert(iter->is_stable());
       return CachedExtentRef(&*iter);
     } else {
       return CachedExtentRef();
index 96cf91b1d43b959193e909543de34de9218f101b..6c5c6c6fcc2928d8516af1a11c520790baa6d6f0 100644 (file)
@@ -786,7 +786,7 @@ protected:
 
   struct retired_placeholder_t{};
   CachedExtent(retired_placeholder_t, extent_len_t _length)
-    : state(extent_state_t::INVALID),
+    : state(extent_state_t::CLEAN),
       length(_length) {
     assert(length > 0);
   }