summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_cache.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-04-29 16:55:26 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:02 -0400
commite68031fb468aff9963d344d04e2de8824c83c8ae (patch)
tree5182ee8ba35892bddd0cd55480c9b503d14e6237 /fs/bcachefs/btree_cache.c
parent595c1e9bab7fd5512250d0e297e50a549af59b1f (diff)
bcachefs: Mark newly allocated btree nodes as accessed
This was a major oversight - this means under memory pressure we can end up reading in a btree node, then having it evicted before we get to use it. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_cache.c')
-rw-r--r--fs/bcachefs/btree_cache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 85c19e4e5216..a13e5eef868e 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -590,6 +590,7 @@ out:
b->sib_u64s[1] = 0;
b->whiteout_u64s = 0;
bch2_btree_keys_init(b);
+ set_btree_node_accessed(b);
bch2_time_stats_update(&c->times[BCH_TIME_btree_node_mem_alloc],
start_time);