From: Kent Overstreet Date: Sat, 12 Jun 2021 21:20:02 +0000 (-0400) Subject: bcachefs: Allow shorter JSET_ENTRY_dev_usage entries X-Git-Tag: v6.7-rc1~201^2~1515 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=45c2e33f791a6c5ebae0accdbfbfef4720701339;p=linux.git 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 --- diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index a7d08657cb4f..e797d6376a82 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -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;