diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-29 13:47:42 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:32 -0400 |
commit | ba239c954e840875a912230439f28b4e4fbea8ff (patch) | |
tree | a46e408927d580bb1c75f1beb4a93b1d6fbca986 /fs/bcachefs/super-io.h | |
parent | 9ba68f6cdc79b0eab707bf8b50f418da05b6ff5e (diff) | |
download | linux-stable-ba239c954e840875a912230439f28b4e4fbea8ff.tar.gz linux-stable-ba239c954e840875a912230439f28b4e4fbea8ff.tar.bz2 linux-stable-ba239c954e840875a912230439f28b4e4fbea8ff.zip |
bcachefs: bch2_check_set_feature()
New helper function for setting incompatible feature bits
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.h')
-rw-r--r-- | fs/bcachefs/super-io.h | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h index 31b8b8307ac3..402ae563b3c7 100644 --- a/fs/bcachefs/super-io.h +++ b/fs/bcachefs/super-io.h @@ -43,26 +43,6 @@ struct bch_sb_field_ops { struct bch_sb_field *); }; -static inline bool bch2_sb_test_feature(struct bch_sb *sb, - enum bch_sb_features f) -{ - unsigned w = f / 64; - unsigned b = f % 64; - - return le64_to_cpu(sb->features[w]) & (1ULL << b); -} - -static inline void bch2_sb_set_feature(struct bch_sb *sb, - enum bch_sb_features f) -{ - if (!bch2_sb_test_feature(sb, f)) { - unsigned w = f / 64; - unsigned b = f % 64; - - le64_add_cpu(&sb->features[w], 1ULL << b); - } -} - static inline __le64 bch2_sb_magic(struct bch_fs *c) { __le64 ret; @@ -90,6 +70,13 @@ const char *bch2_sb_validate(struct bch_sb_handle *); int bch2_read_super(const char *, struct bch_opts *, struct bch_sb_handle *); int bch2_write_super(struct bch_fs *); +void __bch2_check_set_feature(struct bch_fs *, unsigned); + +static inline void bch2_check_set_feature(struct bch_fs *c, unsigned feat) +{ + if (!(c->sb.features & (1ULL << feat))) + __bch2_check_set_feature(c, feat); +} /* BCH_SB_FIELD_journal: */ |