From 339019377fb2a6c640e9135bb3cf3ec61970e244 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Tue, 27 Aug 2024 16:26:06 +0800 Subject: crimson/os/seastore/cache: add asserts Currently, cached must be stable, and absent must be clean. Signed-off-by: Yingxin Cheng --- src/crimson/os/seastore/cache.h | 8 ++++++++ src/crimson/os/seastore/cached_extent.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/crimson/os') diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 8ee1b9fdab4..647e146a3a5 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -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(); diff --git a/src/crimson/os/seastore/cached_extent.h b/src/crimson/os/seastore/cached_extent.h index 96cf91b1d43..6c5c6c6fcc2 100644 --- a/src/crimson/os/seastore/cached_extent.h +++ b/src/crimson/os/seastore/cached_extent.h @@ -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); } -- cgit v1.2.3