diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-27 22:09:35 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-28 02:38:47 -0400 |
commit | 51c4540ad42380cd4f76f260bf4f9ce752e9ffa6 (patch) | |
tree | 631a1aaca1a098c01e6c6ef1a9e00331148114a9 /fs/bcachefs/journal_io.c | |
parent | c362d6993fe0f3e60e556f1b2d7eec97a3b9809f (diff) |
bcachefs: bcachefs_metadata_version_major_minorbcachefs_major_minor
XXX: verify that we ignore/do not fail if unknown
- superblock sections
- journal entry types
- btree ids
- key types
are present
also verify keys can be extended
also, change how "allowed keys for this btree" works - we _filter_ out
non-allowed keys when reading, only assert that keys we're writing match
filter
also: verion upgrade becomes an enum, not a bool
- none
- compatible
- incompatible
- change tools to use modparamater and scream loudly about doing a
major version upgrade when not supported
- version table needs "version upgrade requires fsck" field
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.c')
-rw-r--r-- | fs/bcachefs/journal_io.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index 7d0dd1b1d5cf..49f2fe413d4f 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -745,14 +745,12 @@ static int jset_validate(struct bch_fs *c, return JOURNAL_ENTRY_NONE; version = le32_to_cpu(jset->version); - if (journal_entry_err_on((version != BCH_JSET_VERSION_OLD && - version < bcachefs_metadata_version_min) || - version >= bcachefs_metadata_version_max, - c, jset, NULL, - "%s sector %llu seq %llu: unknown journal entry version %u", + if (journal_entry_err_on(!bch2_version_compatible(version), c, jset, NULL, + "%s sector %llu seq %llu: incompatible journal entry version %u.%u", ca ? ca->name : c->name, sector, le64_to_cpu(jset->seq), - version)) { + BCH_VERSION_MAJOR(version), + BCH_VERSION_MINOR(version))) { /* don't try to continue: */ return -EINVAL; } @@ -796,14 +794,12 @@ static int jset_validate_early(struct bch_fs *c, return JOURNAL_ENTRY_NONE; version = le32_to_cpu(jset->version); - if (journal_entry_err_on((version != BCH_JSET_VERSION_OLD && - version < bcachefs_metadata_version_min) || - version >= bcachefs_metadata_version_max, - c, jset, NULL, - "%s sector %llu seq %llu: unknown journal entry version %u", + if (journal_entry_err_on(!bch2_version_compatible(version), c, jset, NULL, + "%s sector %llu seq %llu: unknown journal entry version %u.%u", ca ? ca->name : c->name, sector, le64_to_cpu(jset->seq), - version)) { + BCH_VERSION_MAJOR(version), + BCH_VERSION_MINOR(version))) { /* don't try to continue: */ return -EINVAL; } @@ -1755,9 +1751,7 @@ void bch2_journal_write(struct closure *cl) } jset->magic = cpu_to_le64(jset_magic(c)); - jset->version = c->sb.version < bcachefs_metadata_version_bkey_renumber - ? cpu_to_le32(BCH_JSET_VERSION_OLD) - : cpu_to_le32(c->sb.version); + jset->version = cpu_to_le32(c->sb.version); SET_JSET_BIG_ENDIAN(jset, CPU_BIG_ENDIAN); SET_JSET_CSUM_TYPE(jset, bch2_meta_checksum_type(c)); |