linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: honor --linear-lookup=X for Android case
@ 2025-07-25  5:52 Chao Yu via Linux-f2fs-devel
  0 siblings, 0 replies; only message in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-07-25  5:52 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

Behavior summary:
			Android		Distro
By default		disabled	enabled

Android case:

1) enabled -> disabled
- mkfs.f2fs -f -g android -O casefold -C utf8:nohashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]
- fsck.f2fs -g android --nolinear-lookup=1 /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]

- mkfs.f2fs -f -g android -O casefold -C utf8:nohashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]
- fsck.f2fs -g android /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]

2) disabled -> enabled
- mkfs.f2fs -f -g android -O casefold -C utf8:hashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]
- fsck.f2fs -g android --nolinear-lookup=0 /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]

Distro case:

1) enabled -> disabled
- mkfs.f2fs -f -O casefold -C utf8:nohashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]
- fsck.f2fs --nolinear-lookup=1 /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]

2) disabled -> enabled
- mkfs.f2fs -f -O casefold -C utf8:hashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]
- fsck.f2fs --nolinear-lookup=0 /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]

3) default
- mkfs.f2fs -f -O casefold -C utf8:hashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]
- fsck.f2fs /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       2 : 2]

- mkfs.f2fs -f -O casefold -C utf8:nohashonly /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]
- fsck.f2fs /dev/vdb
- dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
s_encoding_flags                        [0x       0 : 0]

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/fsck.c | 9 +++++++++
 fsck/main.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index bb39f8b..4c36dc1 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2425,6 +2425,15 @@ 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);
 
+	/* handle default option for Android case */
+	if ((c.nolinear_lookup == LINEAR_LOOKUP_DEFAULT) &&
+		c.disabled_feature & F2FS_FEATURE_LINEAR_LOOKUP) {
+		c.nolinear_lookup = LINEAR_LOOKUP_DISABLE;
+		MSG(0, "Info: set default linear_lookup option: %s\n",
+			c.nolinear_lookup == LINEAR_LOOKUP_DISABLE ?
+			"disable" : "enable");
+	}
+
 	if (c.nolinear_lookup == LINEAR_LOOKUP_DEFAULT) {
 		MSG(0, "Info: Casefold: linear_lookup [%s]\n",
 			get_sb(s_encoding_flags) & F2FS_ENC_NO_COMPAT_FALLBACK_FL ?
diff --git a/fsck/main.c b/fsck/main.c
index e05c23a..324629e 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -226,7 +226,7 @@ static void add_default_options(void)
 			c.auto_fix = 1;
 
 			/* disable linear lookup by default */
-			c.nolinear_lookup = LINEAR_LOOKUP_DISABLE;
+			c.disabled_feature |= F2FS_FEATURE_LINEAR_LOOKUP;
 		} else if (c.func == RESIZE) {
 			c.force = 1;
 		}
-- 
2.49.0



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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-25  5:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25  5:52 [f2fs-dev] [PATCH] fsck.f2fs: honor --linear-lookup=X for Android case Chao Yu via Linux-f2fs-devel

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