mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 15:51:40 -04:00
bcachefs: Fix journal reclaim loop
When dirty key cache keys were separated from other journal pins, we broke the loop conditional in __bch2_journal_reclaim() - it's supposed to keep looping as long as there's work to do. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
committed by
Kent Overstreet
parent
3e07a7300f
commit
96f399d0ee
@@ -599,7 +599,7 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct)
|
||||
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
||||
bool kthread = (current->flags & PF_KTHREAD) != 0;
|
||||
u64 seq_to_flush;
|
||||
size_t min_nr, nr_flushed;
|
||||
size_t min_nr, min_key_cache, nr_flushed;
|
||||
unsigned flags;
|
||||
int ret = 0;
|
||||
|
||||
@@ -649,9 +649,10 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct)
|
||||
atomic_long_read(&c->btree_key_cache.nr_dirty),
|
||||
atomic_long_read(&c->btree_key_cache.nr_keys));
|
||||
|
||||
min_key_cache = min(bch2_nr_btree_keys_need_flush(c), 128UL);
|
||||
|
||||
nr_flushed = journal_flush_pins(j, seq_to_flush,
|
||||
min_nr,
|
||||
min(bch2_nr_btree_keys_need_flush(c), 128UL));
|
||||
min_nr, min_key_cache);
|
||||
|
||||
if (direct)
|
||||
j->nr_direct_reclaim += nr_flushed;
|
||||
@@ -661,7 +662,7 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct)
|
||||
|
||||
if (nr_flushed)
|
||||
wake_up(&j->reclaim_wait);
|
||||
} while (min_nr && nr_flushed && !direct);
|
||||
} while ((min_nr || min_key_cache) && !direct);
|
||||
|
||||
memalloc_noreclaim_restore(flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user