bcachefs: Have journal reclaim thread flush more aggressively
This adds a new watermark for the journal reclaim when flushing btree key cache entries - it should try and stay ahead of where foreground threads doing transaction commits will enter direct journal reclaim. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
883d9701f1
commit
c5f51cdd5f
@ -1,6 +1,15 @@
|
||||
#ifndef _BCACHEFS_BTREE_KEY_CACHE_H
|
||||
#define _BCACHEFS_BTREE_KEY_CACHE_H
|
||||
|
||||
static inline size_t bch2_nr_btree_keys_want_flush(struct bch_fs *c)
|
||||
{
|
||||
size_t nr_dirty = atomic_long_read(&c->btree_key_cache.nr_dirty);
|
||||
size_t nr_keys = atomic_long_read(&c->btree_key_cache.nr_keys);
|
||||
size_t max_dirty = nr_keys / 4;
|
||||
|
||||
return max_t(ssize_t, 0, nr_dirty - max_dirty);
|
||||
}
|
||||
|
||||
static inline size_t bch2_nr_btree_keys_need_flush(struct bch_fs *c)
|
||||
{
|
||||
size_t nr_dirty = atomic_long_read(&c->btree_key_cache.nr_dirty);
|
||||
|
@ -602,7 +602,7 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct)
|
||||
if (fifo_free(&j->pin) <= 32)
|
||||
min_nr = 1;
|
||||
|
||||
min_nr = max(min_nr, bch2_nr_btree_keys_need_flush(c));
|
||||
min_nr = max(min_nr, bch2_nr_btree_keys_want_flush(c));
|
||||
|
||||
trace_journal_reclaim_start(c,
|
||||
min_nr,
|
||||
|
Loading…
Reference in New Issue
Block a user