@@ -97,8 +97,7 @@ Cache::retire_extent_ret Cache::retire_extent_addr(
9797 TRANS_ID_NULL);
9898 DEBUGT (" retire {}~{} as placeholder, add extent -- {}" ,
9999 t, addr, length, *ext);
100- const auto t_src = t.get_src ();
101- add_extent (ext, &t_src);
100+ add_extent (ext);
102101 }
103102 t.add_to_read_set (ext);
104103 t.add_to_retired_set (ext);
@@ -126,8 +125,7 @@ void Cache::retire_absent_extent_addr(
126125 TRANS_ID_NULL);
127126 DEBUGT (" retire {}~{} as placeholder, add extent -- {}" ,
128127 t, addr, length, *ext);
129- const auto t_src = t.get_src ();
130- add_extent (ext, &t_src);
128+ add_extent (ext);
131129 t.add_to_read_set (ext);
132130 t.add_to_retired_set (ext);
133131}
@@ -727,19 +725,12 @@ void Cache::register_metrics()
727725 );
728726}
729727
730- void Cache::add_extent (
731- CachedExtentRef ref,
732- const Transaction::src_t * p_src=nullptr )
728+ void Cache::add_extent (CachedExtentRef ref)
733729{
734730 assert (ref->is_valid ());
735731 assert (ref->user_hint == PLACEMENT_HINT_NULL);
736732 assert (ref->rewrite_generation == NULL_GENERATION);
737733 extents.insert (*ref);
738- if (ref->is_dirty ()) {
739- add_to_dirty (ref);
740- } else {
741- touch_extent (*ref, p_src);
742- }
743734}
744735
745736void Cache::mark_dirty (CachedExtentRef ref)
@@ -1573,9 +1564,11 @@ void Cache::complete_commit(
15731564 i->prior_instance .reset ();
15741565 DEBUGT (" add extent as fresh, inline={} -- {}" ,
15751566 t, is_inline, *i);
1576- const auto t_src = t.get_src ();
15771567 i->invalidate_hints ();
1578- add_extent (i, &t_src);
1568+ add_extent (i);
1569+ assert (!i->is_dirty ());
1570+ const auto t_src = t.get_src ();
1571+ touch_extent (*i, &t_src);
15791572 epm.commit_space_used (i->get_paddr (), i->get_length ());
15801573 if (is_backref_mapped_extent_node (i)) {
15811574 DEBUGT (" backref_list new {} len {}" ,
@@ -1691,8 +1684,13 @@ void Cache::complete_commit(
16911684 i->get_length (),
16921685 i->get_type (),
16931686 start_seq));
1694- const auto t_src = t.get_src ();
1695- add_extent (i, &t_src);
1687+ add_extent (i);
1688+ if (i->is_dirty ()) {
1689+ add_to_dirty (i);
1690+ } else {
1691+ const auto t_src = t.get_src ();
1692+ touch_extent (*i, &t_src);
1693+ }
16961694 }
16971695 }
16981696 if (!backref_list.empty ()) {
@@ -1868,6 +1866,7 @@ Cache::replay_delta(
18681866 journal_seq, record_base, delta, *root);
18691867 root->set_modify_time (modify_time);
18701868 add_extent (root);
1869+ add_to_dirty (root);
18711870 return replay_delta_ertr::make_ready_future<std::pair<bool , CachedExtentRef>>(
18721871 std::make_pair (true , root));
18731872 } else {
@@ -1895,7 +1894,9 @@ Cache::replay_delta(
18951894 delta.length ,
18961895 nullptr ,
18971896 [](CachedExtent &) {},
1898- [](CachedExtent &) {}) :
1897+ [this ](CachedExtent &ext) {
1898+ touch_extent (ext);
1899+ }) :
18991900 _get_extent_if_cached (
19001901 delta.paddr )
19011902 ).handle_error (
0 commit comments