bcachefs: Allow shorter JSET_ENTRY_dev_usage entries

If the last entry(ies) would be all zeros, there's no need to write them
out - the read path already handles that.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-06-12 17:20:02 -04:00 committed by Kent Overstreet
parent 044c8c9e05
commit 45c2e33f79

View file

@ -449,7 +449,7 @@ static int journal_entry_validate_dev_usage(struct bch_fs *c,
struct jset_entry_dev_usage *u =
container_of(entry, struct jset_entry_dev_usage, entry);
unsigned bytes = jset_u64s(le16_to_cpu(entry->u64s)) * sizeof(u64);
unsigned expected = sizeof(*u) + sizeof(u->d[0]) * 7; /* Current value of BCH_DATA_NR */
unsigned expected = sizeof(*u);
unsigned dev;
int ret = 0;