Skip to contentSkip to conversation

f2fs: add compression feature check for all compress mount opt

PATCH Applied Yangtao Li 3 participants 3 messages Mar 19, 2023 – Mar 27, 2023 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v2 1/1 f2fs: add compression feature check for all compress mount opt

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.

---
v2:
-drop f2fs_mount_opt_need_skip()

 fs/f2fs/super.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
fs/f2fs/super.c +12 -0
index 9c87d91df61b..a88706bbfc0d 100644
@@ -1179,9 +1179,17 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			kfree(name);
 			break;
 		case Opt_compress_chksum:
+			if (!f2fs_sb_has_compression(sbi)) {
+				f2fs_info(sbi, "Image doesn't support compression");
+				break;
+			}
 			F2FS_OPTION(sbi).compress_chksum = true;
 			break;
 		case Opt_compress_mode:
+			if (!f2fs_sb_has_compression(sbi)) {
+				f2fs_info(sbi, "Image doesn't support compression");
+				break;
+			}
 			name = match_strdup(&args[0]);
 			if (!name)
 				return -ENOMEM;
@@ -1196,6 +1204,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			kfree(name);
 			break;
 		case Opt_compress_cache:
+			if (!f2fs_sb_has_compression(sbi)) {
+				f2fs_info(sbi, "Image doesn't support compression");
+				break;
+			}
 			set_opt(sbi, COMPRESS_CACHE);
 			break;
 #else
Signature · 1 line
2.35.1
#2 lore raw
In reply to Yangtao Li
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 10 lines · On Sun, 19 Mar 2023 15:51:30 +0800 you 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.

---
v2:
-drop f2fs_mount_opt_need_skip()

 fs/f2fs/super.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Here is the summary with links:
- [f2fs-dev,v2] f2fs: add compression feature check for all compress mount opt

    https://git.kernel.org/jaegeuk/f2fs/c/2f3d837dbaa0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html