Skip to contentSkip to conversation

f2fs: set default compress option only when sb_has_compression

PATCH RESEND Applied Yangtao Li 3 participants 3 messages Mar 30, 2023 – Apr 5, 2023 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH RESEND 1/1 f2fs: set default compress option only when sb_has_compression

If the compress feature is not enabled, there is no need to set compress-related parameters.

---
 fs/f2fs/super.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
fs/f2fs/super.c +6 -4
index 768be1c76a47..b5828a67f7c1 100644
@@ -2073,10 +2073,12 @@ static void default_options(struct f2fs_sb_info *sbi)
 	F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX;
 	F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID);
 	F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID);
-	F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;
-	F2FS_OPTION(sbi).compress_log_size = MIN_COMPRESS_LOG_SIZE;
-	F2FS_OPTION(sbi).compress_ext_cnt = 0;
-	F2FS_OPTION(sbi).compress_mode = COMPR_MODE_FS;
+	if (f2fs_sb_has_compression(sbi)) {
+		F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;
+		F2FS_OPTION(sbi).compress_log_size = MIN_COMPRESS_LOG_SIZE;
+		F2FS_OPTION(sbi).compress_ext_cnt = 0;
+		F2FS_OPTION(sbi).compress_mode = COMPR_MODE_FS;
+	}
 	F2FS_OPTION(sbi).bggc_mode = BGGC_MODE_ON;
 	F2FS_OPTION(sbi).memory_mode = MEMORY_MODE_NORMAL;
 
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Yangtao Li

If the compress feature is not enabled, there is no need to set compress-related parameters.

Patch looks fine, but it's better to fix similar issues in one patch.

e.g.
f2fs: add compression feature check for all compress mount opt

Thanks,

Quoted 25 lines
---
  fs/f2fs/super.c | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
fs/f2fs/super.c +6 -4
index 768be1c76a47..b5828a67f7c1 100644
@@ -2073,10 +2073,12 @@ static void default_options(struct f2fs_sb_info *sbi)
  	F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX;
  	F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID);
  	F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID);
-	F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;
-	F2FS_OPTION(sbi).compress_log_size = MIN_COMPRESS_LOG_SIZE;
-	F2FS_OPTION(sbi).compress_ext_cnt = 0;
-	F2FS_OPTION(sbi).compress_mode = COMPR_MODE_FS;
+	if (f2fs_sb_has_compression(sbi)) {
+		F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;
+		F2FS_OPTION(sbi).compress_log_size = MIN_COMPRESS_LOG_SIZE;
+		F2FS_OPTION(sbi).compress_ext_cnt = 0;
+		F2FS_OPTION(sbi).compress_mode = COMPR_MODE_FS;
+	}
  	F2FS_OPTION(sbi).bggc_mode = BGGC_MODE_ON;
  	F2FS_OPTION(sbi).memory_mode = MEMORY_MODE_NORMAL;
 
#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 7 lines · On Fri, 31 Mar 2023 00:56:48 +0800 you wrote:

If the compress feature is not enabled, there is no need to set compress-related parameters.

---
 fs/f2fs/super.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Here is the summary with links:
- [f2fs-dev,RESEND] f2fs: set default compress option only when sb_has_compression

    https://git.kernel.org/jaegeuk/f2fs/c/338abb312bb2

You are awesome, thank you!

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