btrfs: improve messages when updating feature flags

Currently the messages printed after setting an incompat feature are
cryptis, we can easily make it better as the textual description is
passed to the helpers. Old:

  setting 128 feature flag

updated:

  setting incompat feature flag for RAID56 (0x80)

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2019-06-13 17:55:03 +02:00
parent 6c64460cdc
commit c9d713d5b5
1 changed files with 24 additions and 16 deletions

View File

@ -3636,10 +3636,11 @@ do { \
/* compatibility and incompatibility defines */ /* compatibility and incompatibility defines */
#define btrfs_set_fs_incompat(__fs_info, opt) \ #define btrfs_set_fs_incompat(__fs_info, opt) \
__btrfs_set_fs_incompat((__fs_info), BTRFS_FEATURE_INCOMPAT_##opt) __btrfs_set_fs_incompat((__fs_info), BTRFS_FEATURE_INCOMPAT_##opt, \
#opt)
static inline void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info, static inline void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info,
u64 flag) u64 flag, const char* name)
{ {
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
u64 features; u64 features;
@ -3652,18 +3653,20 @@ static inline void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info,
if (!(features & flag)) { if (!(features & flag)) {
features |= flag; features |= flag;
btrfs_set_super_incompat_flags(disk_super, features); btrfs_set_super_incompat_flags(disk_super, features);
btrfs_info(fs_info, "setting %llu feature flag", btrfs_info(fs_info,
flag); "setting incompat feature flag for %s (0x%llx)",
name, flag);
} }
spin_unlock(&fs_info->super_lock); spin_unlock(&fs_info->super_lock);
} }
} }
#define btrfs_clear_fs_incompat(__fs_info, opt) \ #define btrfs_clear_fs_incompat(__fs_info, opt) \
__btrfs_clear_fs_incompat((__fs_info), BTRFS_FEATURE_INCOMPAT_##opt) __btrfs_clear_fs_incompat((__fs_info), BTRFS_FEATURE_INCOMPAT_##opt, \
#opt)
static inline void __btrfs_clear_fs_incompat(struct btrfs_fs_info *fs_info, static inline void __btrfs_clear_fs_incompat(struct btrfs_fs_info *fs_info,
u64 flag) u64 flag, const char* name)
{ {
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
u64 features; u64 features;
@ -3676,8 +3679,9 @@ static inline void __btrfs_clear_fs_incompat(struct btrfs_fs_info *fs_info,
if (features & flag) { if (features & flag) {
features &= ~flag; features &= ~flag;
btrfs_set_super_incompat_flags(disk_super, features); btrfs_set_super_incompat_flags(disk_super, features);
btrfs_info(fs_info, "clearing %llu feature flag", btrfs_info(fs_info,
flag); "clearing incompat feature flag for %s (0x%llx)",
name, flag);
} }
spin_unlock(&fs_info->super_lock); spin_unlock(&fs_info->super_lock);
} }
@ -3694,10 +3698,11 @@ static inline bool __btrfs_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag)
} }
#define btrfs_set_fs_compat_ro(__fs_info, opt) \ #define btrfs_set_fs_compat_ro(__fs_info, opt) \
__btrfs_set_fs_compat_ro((__fs_info), BTRFS_FEATURE_COMPAT_RO_##opt) __btrfs_set_fs_compat_ro((__fs_info), BTRFS_FEATURE_COMPAT_RO_##opt, \
#opt)
static inline void __btrfs_set_fs_compat_ro(struct btrfs_fs_info *fs_info, static inline void __btrfs_set_fs_compat_ro(struct btrfs_fs_info *fs_info,
u64 flag) u64 flag, const char *name)
{ {
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
u64 features; u64 features;
@ -3710,18 +3715,20 @@ static inline void __btrfs_set_fs_compat_ro(struct btrfs_fs_info *fs_info,
if (!(features & flag)) { if (!(features & flag)) {
features |= flag; features |= flag;
btrfs_set_super_compat_ro_flags(disk_super, features); btrfs_set_super_compat_ro_flags(disk_super, features);
btrfs_info(fs_info, "setting %llu ro feature flag", btrfs_info(fs_info,
flag); "setting compat-ro feature flag for %s (0x%llx)",
name, flag);
} }
spin_unlock(&fs_info->super_lock); spin_unlock(&fs_info->super_lock);
} }
} }
#define btrfs_clear_fs_compat_ro(__fs_info, opt) \ #define btrfs_clear_fs_compat_ro(__fs_info, opt) \
__btrfs_clear_fs_compat_ro((__fs_info), BTRFS_FEATURE_COMPAT_RO_##opt) __btrfs_clear_fs_compat_ro((__fs_info), BTRFS_FEATURE_COMPAT_RO_##opt, \
#opt)
static inline void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, static inline void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info,
u64 flag) u64 flag, const char *name)
{ {
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
u64 features; u64 features;
@ -3734,8 +3741,9 @@ static inline void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info,
if (features & flag) { if (features & flag) {
features &= ~flag; features &= ~flag;
btrfs_set_super_compat_ro_flags(disk_super, features); btrfs_set_super_compat_ro_flags(disk_super, features);
btrfs_info(fs_info, "clearing %llu ro feature flag", btrfs_info(fs_info,
flag); "clearing compat-ro feature flag for %s (0x%llx)",
name, flag);
} }
spin_unlock(&fs_info->super_lock); spin_unlock(&fs_info->super_lock);
} }