bcachefs: Validate number of counters for accounting keys
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 25 Mar 2025 14:06:33 +0000 (10:06 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 26 Mar 2025 20:26:35 +0000 (16:26 -0400)
commit9c893face2f0506f0f21ad71b0d77dae34d6b569
treed5c0eed6ebd8af22c4c666ce3c9c726b913f11d5
parente1e50a63308f5f97587e89a17084a7fd65d4958f
bcachefs: Validate number of counters for accounting keys

We weren't checking that accounting keys have the expected number of
accounters. Originally we probably wanted to be flexible on this, but it
doesn't look like that will be required - accounting is extended by
adding new counter types, not more counters to an existing type.

This means we can drop a BUG_ON() that popped once in automated testing,
and the new validation will make that bug easier to track down.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/disk_accounting.c
fs/bcachefs/disk_accounting.h
fs/bcachefs/disk_accounting_format.h
fs/bcachefs/sb-errors_format.h