diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-01 00:52:52 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:58 +0300 |
commit | 24db24c749913f71cd90355528bad522cf197f62 (patch) | |
tree | c17da3fec4ad78a7a0b99e372ab0585d98d09cb6 /fs/bcachefs/journal_reclaim.c | |
parent | 65bcd6579df322d0c6216a534c65ee41eda2b801 (diff) | |
download | linux-24db24c749913f71cd90355528bad522cf197f62.tar.xz |
bcachefs: Don't make foreground writes wait behind journal reclaim too long
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_reclaim.c')
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 17af2bbeadee..3ef42a47f60d 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -604,6 +604,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct) min_nr = max(min_nr, bch2_nr_btree_keys_want_flush(c)); + /* Don't do too many without delivering wakeup: */ + min_nr = min(min_nr, 128UL); + trace_journal_reclaim_start(c, min_nr, j->prereserved.reserved, @@ -620,6 +623,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct) else j->nr_background_reclaim += nr_flushed; trace_journal_reclaim_finish(c, nr_flushed); + + if (nr_flushed) + wake_up(&j->reclaim_wait); } while (min_nr && nr_flushed); memalloc_noreclaim_restore(flags); |