summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super-io.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-29 03:27:07 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:05 +0300
commita02a0121b3de81f985d6c751f1557c7aea832b9a (patch)
treebe6dcc255c2c8b389fa9743345e4b91ce2dfb40d /fs/bcachefs/super-io.h
parente3804b55e4358cf5a235fa1ba32204af9f7046dd (diff)
downloadlinux-a02a0121b3de81f985d6c751f1557c7aea832b9a.tar.xz
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/super-io.h')
-rw-r--r--fs/bcachefs/super-io.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h
index 4a193add3447..cda71ec845a5 100644
--- a/fs/bcachefs/super-io.h
+++ b/fs/bcachefs/super-io.h
@@ -9,6 +9,12 @@
#include <asm/byteorder.h>
+static inline bool bch2_version_compatible(u16 version)
+{
+ return version <= bcachefs_metadata_version_current &&
+ version >= bcachefs_metadata_version_min;
+}
+
void bch2_version_to_text(struct printbuf *, unsigned);
struct bch_sb_field *bch2_sb_field_get(struct bch_sb *, enum bch_sb_field_type);