bcachefs: Fold bucket_state in to BCH_DATA_TYPES()
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 1 Apr 2022 05:29:59 +0000 (01:29 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:30 +0000 (17:09 -0400)
commit822835ffeae411bbc8af104da9331fdf63a7bc12
tree57d2b7fd487fc05d58464ea179d435ff4d149bc9
parent8058ea64c31c8700eaab48c38a143d1c3817f1de
bcachefs: Fold bucket_state in to BCH_DATA_TYPES()

Previously, we were missing accounting for buckets in need_gc_gens and
need_discard states. This matters because buckets in those states need
other btree operations done before they can be used, so they can't be
conuted when checking current number of free buckets against the
allocation watermark.

Also, we weren't directly counting free buckets at all. Now, data type 0
== BCH_DATA_free, and free buckets are counted; this means we can get
rid of the separate (poorly defined) count of unavailable buckets.

This is a new on disk format version, with upgrade and fsck required for
the accounting changes.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
19 files changed:
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.h
fs/bcachefs/alloc_foreground.c
fs/bcachefs/alloc_types.h
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_ioctl.h
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.h
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h
fs/bcachefs/buckets_types.h
fs/bcachefs/chardev.c
fs/bcachefs/journal_io.c
fs/bcachefs/lru.c
fs/bcachefs/movinggc.c
fs/bcachefs/recovery.c
fs/bcachefs/super-io.c
fs/bcachefs/super.c
fs/bcachefs/sysfs.c