Skip to contentSkip to conversation

f2fs: compress: deny setting unsupported compress algorithm

PATCH RESEND Superseded Chao Yu 2 participants 4 messages Dec 7, 2020 – Dec 8, 2020 F2FS file system

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH RESEND 1/1 f2fs: compress: deny setting unsupported compress algorithm

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.

---
no changes, just rebase on dev branch.

 fs/f2fs/super.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
fs/f2fs/super.c +16 -0
index e0fe72f1d2c8..662e59f32645 100644
@@ -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;
Signature · 8 lines
2.29.2



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw
Quoted 6 lines · 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.

---
no changes, just rebase on dev branch.

This doesn't apply to the dev branch anymore.

Quoted 8 lines
 fs/f2fs/super.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
fs/f2fs/super.c +0 -0
index e0fe72f1d2c8..662e59f32645 100644

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 944

Quoted 9 lines
fs/f2fs/super.c +4 -0
@@ -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

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#2 lore raw
Quoted 9 lines · Eric Biggers
Quoted 6 lines · 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.

---
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

Quoted 22 lines
Quoted 9 lines
  fs/f2fs/super.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
fs/f2fs/super.c +0 -0
index e0fe72f1d2c8..662e59f32645 100644

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 944

Quoted 9 lines
fs/f2fs/super.c +4 -0
@@ -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.

Quoted 1 line

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

Correct.

Quoted 4 lines

- Eric
.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#3 lore raw
Quoted 9 lines · Chao Yu
Quoted 8 lines · Eric Biggers
Quoted 6 lines · 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.

---
no changes, just rebase on dev branch.

Quoted 29 lines
Quoted 1 line

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

Quoted 23 lines
Quoted 9 lines
   fs/f2fs/super.c | 16 ++++++++++++++++
   1 file changed, 16 insertions(+)
fs/f2fs/super.c +0 -0
index e0fe72f1d2c8..662e59f32645 100644

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 944

Quoted 9 lines
fs/f2fs/super.c +4 -0
@@ -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.

Quoted 9 lines

Correct.

Quoted 4 lines

- Eric
.

Quoted 6 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel