linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm
@ 2020-12-07  9:56 Chao Yu
  2020-12-07 18:16 ` [f2fs-dev] " Eric Biggers
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2020-12-07  9:56 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

If kernel doesn't support certain kinds of compress algorithm, deny to set
them as compress algorithm of f2fs via 'compress_algorithm=%s' mount option.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
no changes, just rebase on dev branch.
 fs/f2fs/super.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index e0fe72f1d2c8..662e59f32645 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -936,9 +936,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			if (!name)
 				return -ENOMEM;
 			if (!strcmp(name, "lzo")) {
+#ifdef CONFIG_F2FS_FS_LZO
 				F2FS_OPTION(sbi).compress_algorithm =
 								COMPRESS_LZO;
+#else
+				f2fs_info(sbi, "Image doesn't support lzo compression");
+#endif
 			} else if (!strncmp(name, "lz4", 3)) {
+#ifdef CONFIG_F2FS_FS_LZ4
 				ret = f2fs_compress_set_level(sbi, name,
 								COMPRESS_LZ4);
 				if (ret) {
@@ -947,7 +952,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 				}
 				F2FS_OPTION(sbi).compress_algorithm =
 								COMPRESS_LZ4;
+#else
+				f2fs_info(sbi, "Image doesn't support lz4 compression");
+#endif
 			} else if (!strncmp(name, "zstd", 4)) {
+#ifdef CONFIG_F2FS_FS_ZSTD
 				ret = f2fs_compress_set_level(sbi, name,
 								COMPRESS_ZSTD);
 				if (ret) {
@@ -956,9 +965,16 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 				}
 				F2FS_OPTION(sbi).compress_algorithm =
 								COMPRESS_ZSTD;
+#else
+				f2fs_info(sbi, "Image doesn't support zstd compression");
+#endif
 			} else if (!strcmp(name, "lzo-rle")) {
+#ifdef CONFIG_F2FS_FS_LZORLE
 				F2FS_OPTION(sbi).compress_algorithm =
 								COMPRESS_LZORLE;
+#else
+				f2fs_info(sbi, "Image doesn't support lzorle compression");
+#endif
 			} else {
 				kfree(name);
 				return -EINVAL;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm
  2020-12-07  9:56 [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm Chao Yu
@ 2020-12-07 18:16 ` Eric Biggers
  2020-12-08  1:09   ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2020-12-07 18:16 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

On Mon, Dec 07, 2020 at 05:56:09PM +0800, Chao Yu wrote:
> If kernel doesn't support certain kinds of compress algorithm, deny to set
> them as compress algorithm of f2fs via 'compress_algorithm=%s' mount option.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> no changes, just rebase on dev branch.

This doesn't apply to the dev branch anymore.

>  fs/f2fs/super.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index e0fe72f1d2c8..662e59f32645 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -936,9 +936,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
>  			if (!name)
>  				return -ENOMEM;
>  			if (!strcmp(name, "lzo")) {
> +#ifdef CONFIG_F2FS_FS_LZO
>  				F2FS_OPTION(sbi).compress_algorithm =
>  								COMPRESS_LZO;
> +#else
> +				f2fs_info(sbi, "Image doesn't support lzo compression");
> +#endif

These info messages don't make sense.  It's not the filesystem image that
doesn't support the algorithm, but rather the kernel that doesn't.

Also, shouldn't these be warnings instead of "info"?

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm
  2020-12-07 18:16 ` [f2fs-dev] " Eric Biggers
@ 2020-12-08  1:09   ` Chao Yu
  2020-12-08  3:29     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2020-12-08  1:09 UTC (permalink / raw)
  To: Eric Biggers; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

On 2020/12/8 2:16, Eric Biggers wrote:
> On Mon, Dec 07, 2020 at 05:56:09PM +0800, Chao Yu wrote:
>> If kernel doesn't support certain kinds of compress algorithm, deny to set
>> them as compress algorithm of f2fs via 'compress_algorithm=%s' mount option.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>> no changes, just rebase on dev branch.
> 
> This doesn't apply to the dev branch anymore.

Maybe you apply patches with wrong order?

https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev

> 
>>   fs/f2fs/super.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>> index e0fe72f1d2c8..662e59f32645 100644
>> --- a/fs/f2fs/super.c
>> +++ b/fs/f2fs/super.c
>> @@ -936,9 +936,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
>>   			if (!name)
>>   				return -ENOMEM;
>>   			if (!strcmp(name, "lzo")) {
>> +#ifdef CONFIG_F2FS_FS_LZO
>>   				F2FS_OPTION(sbi).compress_algorithm =
>>   								COMPRESS_LZO;
>> +#else
>> +				f2fs_info(sbi, "Image doesn't support lzo compression");
>> +#endif
> 
> These info messages don't make sense.  It's not the filesystem image that
> doesn't support the algorithm, but rather the kernel that doesn't.
> 
> Also, shouldn't these be warnings instead of "info"?

Correct.

> 
> - Eric
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm
  2020-12-08  1:09   ` Chao Yu
@ 2020-12-08  3:29     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-12-08  3:29 UTC (permalink / raw)
  To: Eric Biggers; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

On 2020/12/8 9:09, Chao Yu wrote:
> On 2020/12/8 2:16, Eric Biggers wrote:
>> On Mon, Dec 07, 2020 at 05:56:09PM +0800, Chao Yu wrote:
>>> If kernel doesn't support certain kinds of compress algorithm, deny to set
>>> them as compress algorithm of f2fs via 'compress_algorithm=%s' mount option.
>>>
>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>> ---
>>> no changes, just rebase on dev branch.
>>
>> This doesn't apply to the dev branch anymore.
> 
> Maybe you apply patches with wrong order?
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev
> 
>>
>>>    fs/f2fs/super.c | 16 ++++++++++++++++
>>>    1 file changed, 16 insertions(+)
>>>
>>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>>> index e0fe72f1d2c8..662e59f32645 100644
>>> --- a/fs/f2fs/super.c
>>> +++ b/fs/f2fs/super.c
>>> @@ -936,9 +936,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
>>>    			if (!name)
>>>    				return -ENOMEM;
>>>    			if (!strcmp(name, "lzo")) {
>>> +#ifdef CONFIG_F2FS_FS_LZO
>>>    				F2FS_OPTION(sbi).compress_algorithm =
>>>    								COMPRESS_LZO;
>>> +#else
>>> +				f2fs_info(sbi, "Image doesn't support lzo compression");
>>> +#endif
>>
>> These info messages don't make sense.  It's not the filesystem image that
>> doesn't support the algorithm, but rather the kernel that doesn't.
>>
>> Also, shouldn't these be warnings instead of "info"?

I use f2fs_info() in this patch to keep line with other logs, I will send
another patch to use f2fs_warn() instead.

> 
> Correct.
> 
>>
>> - Eric
>> .
>>
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-08  3:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07  9:56 [PATCH RESEND] f2fs: compress: deny setting unsupported compress algorithm Chao Yu
2020-12-07 18:16 ` [f2fs-dev] " Eric Biggers
2020-12-08  1:09   ` Chao Yu
2020-12-08  3:29     ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).