* [PATCH] f2fs: support to disable linear lookup fallback
@ 2025-03-31 2:54 Chao Yu
2025-03-31 16:31 ` Daniel Lee
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2025-03-31 2:54 UTC (permalink / raw)
To: jaegeuk
Cc: linux-f2fs-devel, linux-kernel, Chao Yu, Daniel Lee,
Gabriel Krisman Bertazi
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>
---
fs/f2fs/dir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 5a63ff0df03b..e12445afb95a 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -366,7 +366,8 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
out:
#if IS_ENABLED(CONFIG_UNICODE)
- if (IS_CASEFOLDED(dir) && !de && use_hash) {
+ if (IS_CASEFOLDED(dir) && !de && use_hash &&
+ !sb_no_casefold_compat_fallback(dir->i_sb)) {
use_hash = false;
goto start_find_entry;
}
--
2.49.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: support to disable linear lookup fallback
2025-03-31 2:54 [PATCH] f2fs: support to disable linear lookup fallback Chao Yu
@ 2025-03-31 16:31 ` Daniel Lee
2025-04-01 2:26 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lee @ 2025-03-31 16:31 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel, Gabriel Krisman Bertazi
On Sun, Mar 30, 2025 at 7:54 PM Chao Yu <chao@kernel.org> wrote:
>
> 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>
> ---
> fs/f2fs/dir.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index 5a63ff0df03b..e12445afb95a 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -366,7 +366,8 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
>
> out:
> #if IS_ENABLED(CONFIG_UNICODE)
> - if (IS_CASEFOLDED(dir) && !de && use_hash) {
> + if (IS_CASEFOLDED(dir) && !de && use_hash &&
> + !sb_no_casefold_compat_fallback(dir->i_sb)) {
Would it be beneficial to evaluate
!sb_no_casefold_compat_fallback(dir->i_sb) first for short-circuiting?
>
> use_hash = false;
> goto start_find_entry;
> }
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: support to disable linear lookup fallback
2025-03-31 16:31 ` Daniel Lee
@ 2025-04-01 2:26 ` Chao Yu
0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2025-04-01 2:26 UTC (permalink / raw)
To: Daniel Lee
Cc: chao, jaegeuk, linux-f2fs-devel, linux-kernel, Gabriel Krisman Bertazi
On 4/1/25 00:31, Daniel Lee wrote:
> On Sun, Mar 30, 2025 at 7:54 PM Chao Yu <chao@kernel.org> wrote:
>>
>> 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>
>> ---
>> fs/f2fs/dir.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
>> index 5a63ff0df03b..e12445afb95a 100644
>> --- a/fs/f2fs/dir.c
>> +++ b/fs/f2fs/dir.c
>> @@ -366,7 +366,8 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
>>
>> out:
>> #if IS_ENABLED(CONFIG_UNICODE)
>> - if (IS_CASEFOLDED(dir) && !de && use_hash) {
>> + if (IS_CASEFOLDED(dir) && !de && use_hash &&
>> + !sb_no_casefold_compat_fallback(dir->i_sb)) {
>
>
> Would it be beneficial to evaluate
> !sb_no_casefold_compat_fallback(dir->i_sb) first for short-circuiting?
Yeah, I guess it will when we disable the fallback by default, will update v2,
thank you!
Thanks,
>
>
>>
>> use_hash = false;
>> goto start_find_entry;
>> }
>> --
>> 2.49.0
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-01 2:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-31 2:54 [PATCH] f2fs: support to disable linear lookup fallback Chao Yu
2025-03-31 16:31 ` Daniel Lee
2025-04-01 2:26 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®