Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Arnd Bergmann <arnd@kernel.org>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Filipe Manana <fdmanana@suse.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Anand Jain <anand.jain@oracle.com>,
	Christian Brauner <brauner@kernel.org>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: change mount_opt to u64
Date: Fri, 19 Jul 2024 20:10:48 +0930	[thread overview]
Message-ID: <c51c0e6d-c1ca-4fc0-a0d7-4a1468b137fd@gmx.com> (raw)
In-Reply-To: <20240719103714.1217249-1-arnd@kernel.org>



在 2024/7/19 20:07, Arnd Bergmann 写道:
> From: Arnd Bergmann <arnd@arndb.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@arndb.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;
>   }

  reply	other threads:[~2024-07-19 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 10:37 [PATCH] btrfs: change mount_opt to u64 Arnd Bergmann
2024-07-19 10:40 ` Qu Wenruo [this message]
2024-07-19 13:24 ` David Sterba
2024-07-19 16:07   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c51c0e6d-c1ca-4fc0-a0d7-4a1468b137fd@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=brauner@kernel.org \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox