1

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>
This commit is contained in:
Kent Overstreet 2022-12-02 19:46:49 -05:00
parent 6530d89e0a
commit e153821259
2 changed files with 6 additions and 1 deletions

View File

@ -1514,7 +1514,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

View File

@ -809,6 +809,11 @@ int bch2_write_super(struct bch_fs *c)
closure_init_stack(cl);
memset(&sb_written, 0, sizeof(sb_written));
if (c->opts.version_upgrade) {
c->disk_sb.sb->magic = BCHFS_MAGIC;
c->disk_sb.sb->layout.magic = BCHFS_MAGIC;
}
le64_add_cpu(&c->disk_sb.sb->seq, 1);
if (test_bit(BCH_FS_ERROR, &c->flags))