f2fs: support to disable linear lookup fallback
authorChao Yu <chao@kernel.org>
Tue, 1 Apr 2025 03:58:00 +0000 (11:58 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 12 Apr 2025 17:06:16 +0000 (17:06 +0000)
After commit 91b587ba79e1 ("f2fs: Introduce linear search for
dentries"), f2fs forced to use linear lookup whenever a hash-based
lookup fails on casefolded directory, it may affect performance
for scenarios: a) create a new file w/ filename it doesn't exist
in directory, b) lookup a file which may be removed.

This patch supports to disable linear lookup fallback, so, once there
is a solution for commit 5c26d2f1d3f5 ("unicode: Don't special case
ignorable code points") to fix red heart unicode issue, then we can
set an encodeing flag to disable the fallback for performance recovery.

The way is kept in line w/ ext4, refer to commit 9e28059d5664 ("ext4:
introduce linear search for dentries").

Cc: Daniel Lee <chullee@google.com>
Cc: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c

index 5a63ff0df03b30d61c1e36a1630c1bcf004ce9dd..a9f21bc1915df335ef2f548a8472afbe4798d4ee 100644 (file)
@@ -366,7 +366,8 @@ start_find_entry:
 
 out:
 #if IS_ENABLED(CONFIG_UNICODE)
-       if (IS_CASEFOLDED(dir) && !de && use_hash) {
+       if (!sb_no_casefold_compat_fallback(dir->i_sb) &&
+               IS_CASEFOLDED(dir) && !de && use_hash) {
                use_hash = false;
                goto start_find_entry;
        }