From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: add compression feature check for all compress mount opt
Date: Wed, 18 Jan 2023 18:15:30 -0800 [thread overview]
Message-ID: <Y8inwtRzVHXsxxyT@google.com> (raw)
In-Reply-To: <20230112201032.66300-1-frank.li@vivo.com>
On 01/13, Yangtao Li wrote:
> Opt_compress_chksum, Opt_compress_mode and Opt_compress_cache
> lack the necessary check to see if the image supports compression,
> let's add it.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/f2fs/super.c | 55 +++++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 27 deletions(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 5fc83771042d..8ef1449272b3 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -89,7 +89,7 @@ static struct shrinker f2fs_shrinker_info = {
> .seeks = DEFAULT_SEEKS,
> };
>
> -enum {
> +enum f2fs_mount_opt {
> Opt_gc_background,
> Opt_disable_roll_forward,
> Opt_norecovery,
> @@ -655,6 +655,30 @@ static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str)
> #endif
> #endif
>
> +static bool f2fs_mount_opt_need_skip(struct f2fs_sb_info *sbi, enum f2fs_mount_opt opt)
> +{
> + switch (opt) {
> + case Opt_compress_algorithm:
> + case Opt_compress_log_size:
> + case Opt_compress_extension:
> + case Opt_nocompress_extension:
> + case Opt_compress_chksum:
> + case Opt_compress_mode:
> + case Opt_compress_cache:
> +#ifdef CONFIG_F2FS_FS_COMPRESSION
> + if (f2fs_sb_has_compression(sbi))
> + return false;
> +
> + f2fs_info(sbi, "Image doesn't support compression");
> +#else
> + f2fs_info(sbi, "compression options not supported");
> +#endif
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> static int parse_options(struct super_block *sb, char *options, bool is_remount)
> {
> struct f2fs_sb_info *sbi = F2FS_SB(sb);
> @@ -685,6 +709,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> args[0].to = args[0].from = NULL;
> token = match_token(p, f2fs_tokens, args);
>
> + if (f2fs_mount_opt_need_skip(sbi, token))
> + continue;
It seems this changes the behavior?
> +
> switch (token) {
> case Opt_gc_background:
> name = match_strdup(&args[0]);
> @@ -1068,10 +1095,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> break;
> #ifdef CONFIG_F2FS_FS_COMPRESSION
> case Opt_compress_algorithm:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1122,10 +1145,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> kfree(name);
> break;
> case Opt_compress_log_size:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> if (args->from && match_int(args, &arg))
> return -EINVAL;
> if (arg < MIN_COMPRESS_LOG_SIZE ||
> @@ -1137,10 +1156,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> F2FS_OPTION(sbi).compress_log_size = arg;
> break;
> case Opt_compress_extension:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1161,10 +1176,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> kfree(name);
> break;
> case Opt_nocompress_extension:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1204,16 +1215,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> case Opt_compress_cache:
> set_opt(sbi, COMPRESS_CACHE);
> break;
> -#else
> - case Opt_compress_algorithm:
> - case Opt_compress_log_size:
> - case Opt_compress_extension:
> - case Opt_nocompress_extension:
> - case Opt_compress_chksum:
> - case Opt_compress_mode:
> - case Opt_compress_cache:
> - f2fs_info(sbi, "compression options not supported");
> - break;
> #endif
> case Opt_atgc:
> set_opt(sbi, ATGC);
> --
> 2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: add compression feature check for all compress mount opt
Date: Wed, 18 Jan 2023 18:15:30 -0800 [thread overview]
Message-ID: <Y8inwtRzVHXsxxyT@google.com> (raw)
In-Reply-To: <20230112201032.66300-1-frank.li@vivo.com>
On 01/13, Yangtao Li wrote:
> Opt_compress_chksum, Opt_compress_mode and Opt_compress_cache
> lack the necessary check to see if the image supports compression,
> let's add it.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/f2fs/super.c | 55 +++++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 27 deletions(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 5fc83771042d..8ef1449272b3 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -89,7 +89,7 @@ static struct shrinker f2fs_shrinker_info = {
> .seeks = DEFAULT_SEEKS,
> };
>
> -enum {
> +enum f2fs_mount_opt {
> Opt_gc_background,
> Opt_disable_roll_forward,
> Opt_norecovery,
> @@ -655,6 +655,30 @@ static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str)
> #endif
> #endif
>
> +static bool f2fs_mount_opt_need_skip(struct f2fs_sb_info *sbi, enum f2fs_mount_opt opt)
> +{
> + switch (opt) {
> + case Opt_compress_algorithm:
> + case Opt_compress_log_size:
> + case Opt_compress_extension:
> + case Opt_nocompress_extension:
> + case Opt_compress_chksum:
> + case Opt_compress_mode:
> + case Opt_compress_cache:
> +#ifdef CONFIG_F2FS_FS_COMPRESSION
> + if (f2fs_sb_has_compression(sbi))
> + return false;
> +
> + f2fs_info(sbi, "Image doesn't support compression");
> +#else
> + f2fs_info(sbi, "compression options not supported");
> +#endif
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> static int parse_options(struct super_block *sb, char *options, bool is_remount)
> {
> struct f2fs_sb_info *sbi = F2FS_SB(sb);
> @@ -685,6 +709,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> args[0].to = args[0].from = NULL;
> token = match_token(p, f2fs_tokens, args);
>
> + if (f2fs_mount_opt_need_skip(sbi, token))
> + continue;
It seems this changes the behavior?
> +
> switch (token) {
> case Opt_gc_background:
> name = match_strdup(&args[0]);
> @@ -1068,10 +1095,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> break;
> #ifdef CONFIG_F2FS_FS_COMPRESSION
> case Opt_compress_algorithm:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1122,10 +1145,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> kfree(name);
> break;
> case Opt_compress_log_size:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> if (args->from && match_int(args, &arg))
> return -EINVAL;
> if (arg < MIN_COMPRESS_LOG_SIZE ||
> @@ -1137,10 +1156,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> F2FS_OPTION(sbi).compress_log_size = arg;
> break;
> case Opt_compress_extension:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1161,10 +1176,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> kfree(name);
> break;
> case Opt_nocompress_extension:
> - if (!f2fs_sb_has_compression(sbi)) {
> - f2fs_info(sbi, "Image doesn't support compression");
> - break;
> - }
> name = match_strdup(&args[0]);
> if (!name)
> return -ENOMEM;
> @@ -1204,16 +1215,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> case Opt_compress_cache:
> set_opt(sbi, COMPRESS_CACHE);
> break;
> -#else
> - case Opt_compress_algorithm:
> - case Opt_compress_log_size:
> - case Opt_compress_extension:
> - case Opt_nocompress_extension:
> - case Opt_compress_chksum:
> - case Opt_compress_mode:
> - case Opt_compress_cache:
> - f2fs_info(sbi, "compression options not supported");
> - break;
> #endif
> case Opt_atgc:
> set_opt(sbi, ATGC);
> --
> 2.25.1
next prev parent reply other threads:[~2023-01-19 2:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 20:10 [f2fs-dev] [PATCH] f2fs: add compression feature check for all compress mount opt Yangtao Li via Linux-f2fs-devel
2023-01-12 20:10 ` Yangtao Li
2023-01-19 2:15 ` Jaegeuk Kim [this message]
2023-01-19 2:15 ` Jaegeuk Kim
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=Y8inwtRzVHXsxxyT@google.com \
--to=jaegeuk@kernel.org \
--cc=frank.li@vivo.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.