diff options
author | Coly Li <colyli@suse.de> | 2021-01-22 23:05:07 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2021-01-22 23:19:04 +0800 |
commit | 9e72a28b0faca4754ebcc1d7030d555120b03be4 (patch) | |
tree | a7a00e4de3e0869c3f565bc95b338af88d949b72 | |
parent | 59338c230950a9d20ed210b9b169eb91fc8b37d8 (diff) | |
download | bcache-tools-9e72a28b0faca4754ebcc1d7030d555120b03be4.tar.gz |
bcache-tools: Update super block version in bch_set_feature_* routines
When calling bch_set_feature_* routines, it indicates the super block
supports feature set and its version of cache device should at least be
BCACHE_SB_VERSION_CDEV_WITH_FEATURES.
In order to always keep the cache device super block version being
updated, this patch checks whether the super block version is set
correctly when calling bch_set_feature_* routines, if not then set
the version to BCACHE_SB_VERSION_CDEV_WITH_FEATURES.
Signed-off-by: Coly Li <colyli@suse.de>
-rw-r--r-- | bcache.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -228,6 +228,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ } \ static inline void bch_set_feature_##name(struct cache_sb *sb) \ { \ + if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ (sb)->feature_compat |= \ BCH##_FEATURE_COMPAT_##flagname; \ } \ @@ -245,6 +247,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ } \ static inline void bch_set_feature_##name(struct cache_sb *sb) \ { \ + if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ (sb)->feature_ro_compat |= \ BCH##_FEATURE_RO_COMPAT_##flagname; \ } \ @@ -262,6 +266,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ } \ static inline void bch_set_feature_##name(struct cache_sb *sb) \ { \ + if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ (sb)->feature_incompat |= \ BCH##_FEATURE_INCOMPAT_##flagname; \ } \ |