Commit 637de729 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent c782c583
...@@ -640,6 +640,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct, bool kicked) ...@@ -640,6 +640,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct, bool kicked)
if (fifo_free(&j->pin) <= 32) if (fifo_free(&j->pin) <= 32)
min_nr = 1; 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); min_key_cache = min(bch2_nr_btree_keys_need_flush(c), (size_t) 128);
trace_and_count(c, journal_reclaim_start, c, trace_and_count(c, journal_reclaim_start, c,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment