diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-12-02 19:46:49 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-12-02 19:46:49 -0500 |
commit | be2d60d9484734b4c619ac0ddf54b3103210c9c0 (patch) | |
tree | b0a2728690cdbaa0fd821a367ace0cf6d774c75b | |
parent | 2a961219e335c7866f364c6114a29d277eefee7c (diff) |
bcachefs: New magic number
Add a new bcachefs-specific magic number for the superblock, instead of
continuing to use the old bcache magic number3
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 5 | ||||
-rw-r--r-- | fs/bcachefs/super-io.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 0aa522b7f0f2..f29e3e7e9525 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -1578,7 +1578,7 @@ struct bch_sb_layout { * @version_min - Oldest metadata version this filesystem contains; so we can * safely drop compatibility code and refuse to mount filesystems * we'd need it for - * @magic - identifies as a bcachefs superblock (BCACHE_MAGIC) + * @magic - identifies as a bcachefs superblock (BCHFS_MAGIC) * @seq - incremented each time superblock is written * @uuid - used for generating various magic numbers and identifying * member devices, never changes @@ -1894,6 +1894,9 @@ enum bch_compression_opts { #define BCACHE_MAGIC \ UUID_LE(0xf67385c6, 0x1a4e, 0xca45, \ 0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81) +#define BCHFS_MAGIC \ + UUID_LE(0xf67385c6, 0xce66, 0xa990, \ + 0xd9, 0x6a, 0x60, 0xcf, 0x80, 0x3d, 0xf7, 0xef) #define BCACHEFS_STATFS_MAGIC 0xca451a4e diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 6d99a5814392..0aa243f5fae6 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -211,7 +211,8 @@ static int validate_sb_layout(struct bch_sb_layout *layout, struct printbuf *out u64 offset, prev_offset, max_sectors; unsigned i; - if (uuid_le_cmp(layout->magic, BCACHE_MAGIC)) { + if (uuid_le_cmp(layout->magic, BCACHE_MAGIC) && + uuid_le_cmp(layout->magic, BCHFS_MAGIC)) { prt_printf(out, "Not a bcachefs superblock layout"); return -BCH_ERR_invalid_sb_layout; } @@ -538,7 +539,8 @@ reread: return ret; } - if (uuid_le_cmp(sb->sb->magic, BCACHE_MAGIC)) { + if (uuid_le_cmp(sb->sb->magic, BCACHE_MAGIC) && + uuid_le_cmp(sb->sb->magic, BCHFS_MAGIC)) { prt_printf(err, "Not a bcachefs superblock"); return -BCH_ERR_invalid_sb_magic; } |