Skip to contentSkip to conversation

fsck.f2fs: tune linear_lookup in f2fs_do_mount()

PATCH Superseded Chao Yu via Linux-f2fs-devel 1 participant 1 message Apr 25, 2025

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.f2fs: tune linear_lookup in f2fs_do_mount()

In order to avoid failing to tune linear_lookup if auto or preen mode is on.

---
 fsck/fsck.c  | 17 ++++++++---------
 fsck/main.c  |  2 --
 fsck/mount.c |  2 ++
 3 files changed, 10 insertions(+), 11 deletions(-)
fsck/fsck.c +8 -9
index 2cff33f..9575dff 100644
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 #include "fsck.h"
+#include "f2fs_fs.h"
 #include "xattr.h"
 #include "quotaio.h"
 #include <time.h>
@@ -2369,26 +2370,24 @@ void fsck_update_sb_flags(struct f2fs_sb_info *sbi)
 	struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
 	u16 flags = get_sb(s_encoding_flags);
 
-	if (c.nolinear_lookup == LINEAR_LOOKUP_DISABLE) {
+	if (c.nolinear_lookup == LINEAR_LOOKUP_DEFAULT) {
+		INFO_MSG("Casefold: linear_lookup [%s]\n",
+			get_sb(s_encoding_flags) & F2FS_ENC_NO_COMPAT_FALLBACK_FL ?
+			"disable" : "enable");
+	} else if (c.nolinear_lookup == LINEAR_LOOKUP_DISABLE) {
 		if (!(flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL)) {
 			flags |= F2FS_ENC_NO_COMPAT_FALLBACK_FL;
 			set_sb(s_encoding_flags, flags);
-			c.fix_on = 1;
-			c.invalid_sb |= SB_ENCODE_FLAG;
 			INFO_MSG("Casefold: disable linear lookup\n");
+			update_superblock(sbi->raw_super, SB_MASK_ALL);
 		}
 	} else if (c.nolinear_lookup == LINEAR_LOOKUP_ENABLE) {
 		if (flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL) {
 			flags &= ~F2FS_ENC_NO_COMPAT_FALLBACK_FL;
 			set_sb(s_encoding_flags, flags);
-			c.fix_on = 1;
-			c.invalid_sb |= SB_ENCODE_FLAG;
 			INFO_MSG("Casefold: enable linear lookup\n");
+			update_superblock(sbi->raw_super, SB_MASK_ALL);
 		}
-	} else {
-		INFO_MSG("Casefold: linear_lookup [%s]\n",
-			get_sb(s_encoding_flags) & F2FS_ENC_NO_COMPAT_FALLBACK_FL ?
-			"disable" : "enable");
 	}
 }
 
fsck/main.c +0 -2
index cb51673..2d968a8 100644
@@ -1004,8 +1004,6 @@ static int do_fsck(struct f2fs_sb_info *sbi)
 			F2FS_FT_DIR, TYPE_INODE, &blk_cnt, &cbc, &child);
 	fsck_chk_quota_files(sbi);
 
-	fsck_update_sb_flags(sbi);
-
 	ret = fsck_verify(sbi);
 	fsck_free(sbi);
 
fsck/mount.c +2 -0
index 08b2687..73d32ec 100644
@@ -4145,6 +4145,8 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi)
 			*ver_ts_ptr = cpu_to_le32(cur_time);
 			update_superblock(sbi->raw_super, SB_MASK_ALL);
 		}
+
+		fsck_update_sb_flags(sbi);
 #endif
 	}
 out:
Signature · 8 lines
2.49.0



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