From: Janpieter Sollie Date: Sun, 13 Jun 2021 20:01:08 +0000 (+0200) Subject: bcachefs: fix a possible bcachefs checksum mapping error opt-checksum enum to type... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=120f63e321fa9fdb1837dd64fcd50e2b144b0d6d;p=linux.git bcachefs: fix a possible bcachefs checksum mapping error opt-checksum enum to type-checksum enum This fixes some rare cases where the metadata checksum option specified may map to the wrong actual checksum type. Signed-off-by: Janpieter Sollie Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index fc6fb302706ac..403e77e2c515d 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -684,7 +684,7 @@ static void write_one_super(struct bch_fs *c, struct bch_dev *ca, unsigned idx) sb->offset = sb->layout.sb_offset[idx]; - SET_BCH_SB_CSUM_TYPE(sb, c->opts.metadata_checksum); + SET_BCH_SB_CSUM_TYPE(sb, bch2_csum_opt_to_type(c->opts.metadata_checksum, false)); sb->csum = csum_vstruct(c, BCH_SB_CSUM_TYPE(sb), null_nonce(), sb);