@@ -665,9 +665,10 @@ class Cache : public ExtentTransViewRetriever {
665665 " {} {}~0x{:x} is absent, add extent and reading range 0x{:x}~0x{:x} ... -- {}" ,
666666 T::TYPE, offset, length, partial_off, partial_len, *ret);
667667 add_extent (ret);
668- // touch_extent() should be included in on_cache
669- on_cache (*ret);
670668 extent_init_func (*ret);
669+ // touch_extent() should be included in on_cache,
670+ // required by add_extent()
671+ on_cache (*ret);
671672 return read_extent<T>(
672673 std::move (ret), partial_off, partial_len, p_src);
673674 }
@@ -685,7 +686,6 @@ class Cache : public ExtentTransViewRetriever {
685686 " {} {}~0x{:x} is absent(placeholder), add extent and reading range 0x{:x}~0x{:x} ... -- {}" ,
686687 T::TYPE, offset, length, partial_off, partial_len, *ret);
687688 extents_index.replace (*ret, *cached);
688- on_cache (*ret);
689689
690690 // replace placeholder in transactions
691691 while (!cached->read_transactions .empty ()) {
@@ -695,6 +695,7 @@ class Cache : public ExtentTransViewRetriever {
695695
696696 cached->state = CachedExtent::extent_state_t ::INVALID;
697697 extent_init_func (*ret);
698+ on_cache (*ret);
698699 return read_extent<T>(
699700 std::move (ret), partial_off, partial_len, p_src);
700701 }
0 commit comments