bcachefs: New bucket invalidate path
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 10 Feb 2022 23:18:41 +0000 (18:18 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:29 +0000 (17:09 -0400)
commitcaece7fe3f1199f0da42b4537434166f99f0c11f
treee745fa43f1e55c0f96715c29770ec46b1e462ed4
parent59cc38b8d43b529d91c249c2eef35c8c3fc9fbd8
bcachefs: New bucket invalidate path

In the old allocator code, preparing an existing empty bucket was part
of the same code path that invalidated buckets containing cached data.
In the new allocator code this is no longer the case: the main allocator
path finds empty buckets (via the new freespace btree), and can't
allocate buckets that contain cached data.

We now need a separate code path to invalidate buckets containing cached
data when we're low on empty buckets, which this patch implements. When
the number of free buckets decreases that triggers the new invalidate
path to run, which uses the LRU btree to pick cached data buckets to
invalidate until we're above our watermark.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.h
fs/bcachefs/bcachefs.h
fs/bcachefs/buckets.c