bcachefs: Fix copygc threshold
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 13 Apr 2021 13:49:23 +0000 (09:49 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:54 +0000 (17:08 -0400)
commitcb66fc5fe4cc806d60d8884cb82b67c357b49640
tree7259c200084c9baf05d68584f2346abe957165e8
parent006d69aa2655f1a0ca4e47666939669f27bb740f
bcachefs: Fix copygc threshold

Awhile back the meaning of is_available_bucket() and thus also
bch_dev_usage->buckets_unavailable changed to include buckets that are
owned by the allocator - this was so that the stat could be persisted
like other allocation information, and wouldn't have to be regenerated
by walking each bucket at mount time.

This broke copygc, which needs to consider buckets that are reclaimable
and haven't yet been grabbed by the allocator thread and moved onta
freelist. This patch fixes that by adding dev_buckets_reclaimable() for
copygc and the allocator thread, and cleans up some of the callers a bit.

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