Commit e323edd6 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix for spinning in journal reclaim on startup

We normally avoid having too many dirty keys in the btree key cache, to
ensure that we can always shrink our caches to reclaim memory if needed.

But this check was causing us to go into an infinite loop on startup, in
the btree insert path before journal reclaim was started.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent d483dd17
...@@ -16,7 +16,8 @@ static inline bool bch2_btree_key_cache_must_wait(struct bch_fs *c) ...@@ -16,7 +16,8 @@ static inline bool bch2_btree_key_cache_must_wait(struct bch_fs *c)
size_t nr_keys = READ_ONCE(c->btree_key_cache.nr_keys); size_t nr_keys = READ_ONCE(c->btree_key_cache.nr_keys);
size_t max_dirty = 4096 + (nr_keys * 3) / 4; size_t max_dirty = 4096 + (nr_keys * 3) / 4;
return nr_dirty > max_dirty; return nr_dirty > max_dirty &&
test_bit(JOURNAL_RECLAIM_STARTED, &c->journal.flags);
} }
struct bkey_cached * struct bkey_cached *
......
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