]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: make sure on_cache is called after extent initialization
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 20 Mar 2025 09:03:27 +0000 (17:03 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 21 Mar 2025 03:19:36 +0000 (11:19 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.h

index 8dfaa04cbcd1032915a546ac42e81344db342530..5be4cb97a35b38956463608a5a96281326819397 100644 (file)
@@ -665,9 +665,10 @@ private:
           "{} {}~0x{:x} is absent, add extent and reading range 0x{:x}~0x{:x} ... -- {}",
           T::TYPE, offset, length, partial_off, partial_len, *ret);
       add_extent(ret);
-      // touch_extent() should be included in on_cache
-      on_cache(*ret);
       extent_init_func(*ret);
+      // touch_extent() should be included in on_cache,
+      // required by add_extent()
+      on_cache(*ret);
       return read_extent<T>(
        std::move(ret), partial_off, partial_len, p_src);
     }
@@ -685,7 +686,6 @@ private:
           "{} {}~0x{:x} is absent(placeholder), add extent and reading range 0x{:x}~0x{:x} ... -- {}",
           T::TYPE, offset, length, partial_off, partial_len, *ret);
       extents_index.replace(*ret, *cached);
-      on_cache(*ret);
 
       // replace placeholder in transactions
       while (!cached->read_transactions.empty()) {
@@ -695,6 +695,7 @@ private:
 
       cached->state = CachedExtent::extent_state_t::INVALID;
       extent_init_func(*ret);
+      on_cache(*ret);
       return read_extent<T>(
        std::move(ret), partial_off, partial_len, p_src);
     }