summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_reclaim.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-11-11 23:50:22 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:52 +0300
commit637de729fc86effe021bd067cccd68efd07f59c0 (patch)
tree38ee967775072e298af2fc5377771ca5516d74e0 /fs/bcachefs/journal_reclaim.c
parentc782c5832e9251ab6f4df837932d959f3e02ab25 (diff)
downloadlinux-637de729fc86effe021bd067cccd68efd07f59c0.tar.xz
bcachefs: Ensure btree node cache is not more than half dirty
Tweak journal reclaim to ensure the btree node cache isn't more than half dirty so that memory reclaim can always make progress - the same as we do for the btree key cache. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/journal_reclaim.c')
-rw-r--r--fs/bcachefs/journal_reclaim.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index e8b7ed8e1333..0f3c103e63ee 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -640,6 +640,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct, bool kicked)
if (fifo_free(&j->pin) <= 32)
min_nr = 1;
+ if (atomic_read(&c->btree_cache.dirty) * 2 > c->btree_cache.used)
+ min_nr = 1;
+
min_key_cache = min(bch2_nr_btree_keys_need_flush(c), (size_t) 128);
trace_and_count(c, journal_reclaim_start, c,