summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-12-03 03:46:49 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:47 +0300
commite15382125948523cd5c887c5fe4fa4303e9a9dc1 (patch)
treedfd132fa442aae03f442c28f73811aca85107600 /fs
parent6530d89e0a598592badde77930269740b44ea2ee (diff)
downloadlinux-e15382125948523cd5c887c5fe4fa4303e9a9dc1.tar.xz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/bcachefs_format.h2
-rw-r--r--fs/bcachefs/super-io.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 6e01fd81e3f0..6ee9321e7d21 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -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
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 42e3ce7c0f8c..e27b301432b1 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -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))