summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-28 20:27:07 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:05 -0400
commita02a0121b3de81f985d6c751f1557c7aea832b9a (patch)
treebe6dcc255c2c8b389fa9743345e4b91ce2dfb40d /fs/bcachefs/btree_io.c
parente3804b55e4358cf5a235fa1ba32204af9f7046dd (diff)
downloadlinux-stable-a02a0121b3de81f985d6c751f1557c7aea832b9a.tar.gz
linux-stable-a02a0121b3de81f985d6c751f1557c7aea832b9a.tar.bz2
linux-stable-a02a0121b3de81f985d6c751f1557c7aea832b9a.zip
bcachefs: bch2_version_compatible()
This adds a new helper for checking if an on-disk version is compatible with the running version of bcachefs - prep work for introducing major:minor version numbers. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_io.c')
-rw-r--r--fs/bcachefs/btree_io.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 990c2fa28114..9985ecd7265d 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -699,11 +699,9 @@ static int validate_bset(struct bch_fs *c, struct bch_dev *ca,
struct printbuf buf2 = PRINTBUF;
int ret = 0;
- btree_err_on((version != BCH_BSET_VERSION_OLD &&
- version < bcachefs_metadata_version_min) ||
- version >= bcachefs_metadata_version_max,
+ btree_err_on(!bch2_version_compatible(version),
BTREE_ERR_INCOMPATIBLE, c, ca, b, i,
- "unsupported bset version");
+ "unsupported bset version %u", version);
if (btree_err_on(version < c->sb.version_min,
BTREE_ERR_FIXABLE, c, NULL, b, i,
@@ -2019,9 +2017,7 @@ do_write:
BUG_ON(BSET_BIG_ENDIAN(i) != CPU_BIG_ENDIAN);
BUG_ON(i->seq != b->data->keys.seq);
- i->version = c->sb.version < bcachefs_metadata_version_bkey_renumber
- ? cpu_to_le16(BCH_BSET_VERSION_OLD)
- : cpu_to_le16(c->sb.version);
+ i->version = cpu_to_le16(c->sb.version);
SET_BSET_OFFSET(i, b->written);
SET_BSET_CSUM_TYPE(i, bch2_meta_checksum_type(c));