]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: assert dirty
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 27 May 2022 08:42:19 +0000 (16:42 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 31 May 2022 02:51:03 +0000 (10:51 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cache.h

index 6734b30389a7967eb6275c967f4c92e85391ad05..b1fee9576e3804b7ce225a0c2928b6534b1a8192 100644 (file)
@@ -695,13 +695,13 @@ void Cache::mark_dirty(CachedExtentRef ref)
   }
 
   lru.remove_from_lru(*ref);
-  add_to_dirty(ref);
   ref->state = CachedExtent::extent_state_t::DIRTY;
+  add_to_dirty(ref);
 }
 
 void Cache::add_to_dirty(CachedExtentRef ref)
 {
-  assert(ref->is_valid());
+  assert(ref->is_dirty());
   assert(!ref->primary_ref_list_hook.is_linked());
   intrusive_ptr_add_ref(&*ref);
   dirty.push_back(*ref);
@@ -746,6 +746,7 @@ void Cache::commit_replace_extent(
     CachedExtentRef next,
     CachedExtentRef prev)
 {
+  assert(next->is_dirty());
   assert(next->get_paddr() == prev->get_paddr());
   assert(next->version == prev->version + 1);
   extents.replace(*next, *prev);
index ac84df837b39e77c62d0fcd871cdb1b6dc773ee4..d707f7e5737dfdf6b8aa0f0bcf14d535e774f39f 100644 (file)
@@ -667,8 +667,8 @@ public:
     auto ret = CachedExtent::make_cached_extent_ref<T>(std::move(result.bp));
     ret->set_paddr(result.paddr);
     ret->hint = hint;
-    t.add_fresh_extent(ret);
     ret->state = CachedExtent::extent_state_t::INITIAL_WRITE_PENDING;
+    t.add_fresh_extent(ret);
     SUBDEBUGT(seastore_cache, "allocated {} {}B extent at {}, hint={} -- {}",
               t, T::TYPE, length, result.paddr, hint, *ret);
     return ret;