btrfs: change mount_opt to u64
PATCH 1/1 btrfs: change mount_opt to u64
From: Arnd Bergmann <[email protected]>
The newly added BTRFS_MOUNT_IGNORESUPERFLAGS flag does not fit into a 32-bit flags word, as shown by this warning on 32-bit architectures:
fs/btrfs/super.c: In function 'btrfs_check_options':fs/btrfs/super.c:666:48: error: conversion from 'enum <anonymous>' to 'long unsigned int' changes value from '4294967296' to '0' [-Werror=overflow]
666 | check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNORESUPERFLAGS, "ignoresuperflags")))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change all interfaces that deal with mount flags to use a 64-bit type on all architectures instead.
----
Please double-check that I got all the instances. I only looked at where the obvious users are, but did not actually try to run this on a 32-bit target
--- fs/btrfs/fs.h | 2 +- fs/btrfs/super.c | 6 +++--- fs/btrfs/super.h | 2 +- fs/btrfs/zoned.c | 2 +- fs/btrfs/zoned.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/fs.h +1 -1
@@ -481,7 +481,7 @@ struct btrfs_fs_info {* required instead of the faster short fsync log commits */ u64 last_trans_log_full_commit; -unsigned long mount_opt; +u64 mount_opt; unsigned long compress_type:4;unsigned int compress_level;
fs/btrfs/super.c +3 -3
@@ -82,7 +82,7 @@ struct btrfs_fs_context {u32 commit_interval;u32 metadata_ratio;u32 thread_pool_size; -unsigned long mount_opt; +u64 mount_opt; unsigned long compress_type:4;unsigned int compress_level;refcount_t refs;
@@ -642,7 +642,7 @@ static void btrfs_clear_oneshot_options(struct btrfs_fs_info *fs_info) }static bool check_ro_option (const struct btrfs_fs_info *fs_info, -unsigned long mount_opt,unsigned long opt, +u64 mount_opt,u64 opt,const char *opt_name) {if (mount_opt & opt) {
@@ -653,7 +653,7 @@ static bool check_ro_option(const struct btrfs_fs_info *fs_info,return false; } -bool btrfs_check_options (const struct btrfs_fs_info *info,unsigned long *mount_opt, +bool btrfs_check_options (const struct btrfs_fs_info *info,u64 *mount_opt,unsigned long flags) {bool ret = true;
fs/btrfs/super.h +1 -1
@@ -10,7 +10,7 @@struct super_block ;struct btrfs_fs_info ; -bool btrfs_check_options (const struct btrfs_fs_info *info,unsigned long *mount_opt, +bool btrfs_check_options (const struct btrfs_fs_info *info,u64 *mount_opt,unsigned long flags);int btrfs_sync_fs (struct super_block *sb,int wait); char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
fs/btrfs/zoned.c +1 -1
@@ -767,7 +767,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)return 0 ; } -int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,unsigned long *mount_opt) +int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,u64 *mount_opt) {if (!btrfs_is_zoned (info))return 0 ;
fs/btrfs/zoned.h +2 -2
@@ -58,7 +58,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache);void btrfs_destroy_dev_zone_info (struct btrfs_device *device);struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info (struct btrfs_device *orig_dev);int btrfs_check_zoned_mode (struct btrfs_fs_info *fs_info); -int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,unsigned long *mount_opt); +int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,u64 *mount_opt);int btrfs_sb_log_location_bdev (struct block_device *bdev,int mirror,int rw,u64 *bytenr_ret); int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,
@@ -130,7 +130,7 @@ static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info) }static inline int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info, -unsigned long *mount_opt) +u64 *mount_opt) {return 0 ; }
Signature · 1 line
2.39.2
Quoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The newly added
BTRFS_MOUNT_IGNORESUPERFLAGSflag does not fit into a 32-bit flags word, as shown by this warning on 32-bit architectures:
fs/btrfs/super.c: In function 'btrfs_check_options':fs/btrfs/super.c:666:48: error: conversion from 'enum <anonymous>' to 'long unsigned int' changes value from '4294967296' to '0' [-Werror=overflow]
666 |check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNORESUPERFLAGS, "ignoresuperflags")))
Quoted 7 lines
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~Change all interfaces that deal with mount flags to use a 64-bit type on all architectures instead.
Fixes 32e6216512b4 ("btrfs: introduce new "rescue=ignoresuperflags" mount option")Signed-off-by Arnd Bergmann <[email protected]>
There is already a patch submitted:
Thanks,
Qu
Quoted 103 lines
----
Please double-check that I got all the instances. I only looked at where the obvious users are, but did not actually try to run this on a 32-bit target--- fs/btrfs/fs.h | 2 +- fs/btrfs/super.c | 6 +++--- fs/btrfs/super.h | 2 +- fs/btrfs/zoned.c | 2 +- fs/btrfs/zoned.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-)fs/btrfs/fs.h +1
-1@@ -481,7 +481,7 @@ struct btrfs_fs_info {* required instead of the faster short fsync log commits */ u64 last_trans_log_full_commit; -unsigned long mount_opt; +u64 mount_opt; unsigned long compress_type:4;unsigned int compress_level;fs/btrfs/super.c +3
-3@@ -82,7 +82,7 @@ struct btrfs_fs_context {u32 commit_interval;u32 metadata_ratio;u32 thread_pool_size; -unsigned long mount_opt; +u64 mount_opt; unsigned long compress_type:4;unsigned int compress_level;refcount_t refs;@@ -642,7 +642,7 @@ static void btrfs_clear_oneshot_options(struct btrfs_fs_info *fs_info) }static bool check_ro_option (const struct btrfs_fs_info *fs_info, -unsigned long mount_opt,unsigned long opt, +u64 mount_opt,u64 opt,const char *opt_name) {if (mount_opt & opt) {@@ -653,7 +653,7 @@ static bool check_ro_option(const struct btrfs_fs_info *fs_info,return false; } -bool btrfs_check_options (const struct btrfs_fs_info *info,unsigned long *mount_opt, +bool btrfs_check_options (const struct btrfs_fs_info *info,u64 *mount_opt,unsigned long flags) {bool ret = true;fs/btrfs/super.h +1
-1@@ -10,7 +10,7 @@struct super_block ;struct btrfs_fs_info ; -bool btrfs_check_options (const struct btrfs_fs_info *info,unsigned long *mount_opt, +bool btrfs_check_options (const struct btrfs_fs_info *info,u64 *mount_opt,unsigned long flags);int btrfs_sync_fs (struct super_block *sb,int wait); char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,fs/btrfs/zoned.c +1
-1@@ -767,7 +767,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)return 0 ; } -int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,unsigned long *mount_opt) +int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,u64 *mount_opt) {if (!btrfs_is_zoned (info))return 0 ;fs/btrfs/zoned.h +2
-2@@ -58,7 +58,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache);void btrfs_destroy_dev_zone_info (struct btrfs_device *device);struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info (struct btrfs_device *orig_dev);int btrfs_check_zoned_mode (struct btrfs_fs_info *fs_info); -int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,unsigned long *mount_opt); +int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info,u64 *mount_opt);int btrfs_sb_log_location_bdev (struct block_device *bdev,int mirror,int rw,u64 *bytenr_ret); int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,@@ -130,7 +130,7 @@ static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info) }static inline int btrfs_check_mountopts_zoned (const struct btrfs_fs_info *info, -unsigned long *mount_opt) +u64 *mount_opt) {return 0 ; }
Quoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The newly added
BTRFS_MOUNT_IGNORESUPERFLAGSflag does not fit into a 32-bit flags word, as shown by this warning on 32-bit architectures:
fs/btrfs/super.c: In function 'btrfs_check_options':fs/btrfs/super.c:666:48: error: conversion from 'enum <anonymous>' to 'long unsigned int' changes value from '4294967296' to '0' [-Werror=overflow]
666 |check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNORESUPERFLAGS, "ignoresuperflags")))| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Change all interfaces that deal with mount flags to use a 64-bit type on all architectures instead.
Fixes 32e6216512b4 ("btrfs: introduce new "rescue=ignoresuperflags" mount option")Signed-off-by Arnd Bergmann <[email protected]>----
Please double-check that I got all the instances. I only looked at where the obvious users are, but did not actually try to run this on a 32-bit target
Thanks, the build issue is known and fix will be sent in 2nd pull reuqest on Monday.
Quoted 14 lines · David Sterba
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The newly added
BTRFS_MOUNT_IGNORESUPERFLAGSflag does not fit into a 32-bit flags word, as shown by this warning on 32-bit architectures:
fs/btrfs/super.c: In function 'btrfs_check_options':fs/btrfs/super.c:666:48: error: conversion from 'enum <anonymous>' to 'long unsigned int' changes value from '4294967296' to '0' [-Werror=overflow]
666 |check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNORESUPERFLAGS, "ignoresuperflags")))| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~Change all interfaces that deal with mount flags to use a 64-bit type on all architectures instead.
Quoted 8 lines
Quoted 5 lines
Fixes 32e6216512b4 ("btrfs: introduce new "rescue=ignoresuperflags" mount option")Signed-off-by Arnd Bergmann <[email protected]>----
Please double-check that I got all the instances. I only looked at where the obvious users are, but did not actually try to run this on a 32-bit targetThanks, the build issue is known and fix will be sent in 2nd pull reuqest on Monday.
^^^^^^
I'll send the pull request rather today.