[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c51c0e6d-c1ca-4fc0-a0d7-4a1468b137fd@gmx.com>
Date: Fri, 19 Jul 2024 20:10:48 +0930
From: Qu Wenruo <quwenruo.btrfs@....com>
To: Arnd Bergmann <arnd@...nel.org>, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>,
Qu Wenruo <wqu@...e.com>
Cc: Arnd Bergmann <arnd@...db.de>, Filipe Manana <fdmanana@...e.com>,
Johannes Thumshirn <johannes.thumshirn@....com>,
Anand Jain <anand.jain@...cle.com>, Christian Brauner <brauner@...nel.org>,
Naohiro Aota <naohiro.aota@....com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: change mount_opt to u64
在 2024/7/19 20:07, Arnd Bergmann 写道:
> From: Arnd Bergmann <arnd@...db.de>
>
> 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.
>
> Fixes: 32e6216512b4 ("btrfs: introduce new "rescue=ignoresuperflags" mount option")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
There is already a patch submitted:
https://lore.kernel.org/linux-btrfs/0955d2c5675a7fe3146292aaa766755f22bcd94b.1720865683.git.wqu@suse.com/
Thanks,
Qu
> ----
> 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(-)
>
> diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
> index 1b2a7aa0af36..20900c7cc35d 100644
> --- a/fs/btrfs/fs.h
> +++ b/fs/btrfs/fs.h
> @@ -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;
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 43052acd7a48..ea7141330e87 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -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;
> diff --git a/fs/btrfs/super.h b/fs/btrfs/super.h
> index d2b8ebb46bc6..98e2444c0d82 100644
> --- a/fs/btrfs/super.h
> +++ b/fs/btrfs/super.h
> @@ -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,
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index df7733044f7e..debab1ab9e71 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -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;
> diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h
> index d66d00c08001..037697878b2a 100644
> --- a/fs/btrfs/zoned.h
> +++ b/fs/btrfs/zoned.h
> @@ -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;
> }
Powered by blists - more mailing lists