* [f2fs-dev] [PATCH] mkfs.f2fs: support -C [no]hashonly to control linear lookup fallback
@ 2025-07-24 3:56 Chao Yu via Linux-f2fs-devel
2025-07-24 15:06 ` Jaegeuk Kim via Linux-f2fs-devel
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-07-24 3:56 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-f2fs-devel
It provides a way to disable linear lookup fallback during mkfs.
Usage:
1. Disable linear lookup:
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]
2. Enable linear lookup:
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]
mkfs.f2fs -f -O casefold -C utf8 /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>
---
lib/libf2fs.c | 1 +
man/mkfs.f2fs.8 | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 2f012c8..0e3e62a 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -1424,6 +1424,7 @@ static const struct enc_flags {
char *param;
} encoding_flags[] = {
{ F2FS_ENC_STRICT_MODE_FL, "strict" },
+ { F2FS_ENC_NO_COMPAT_FALLBACK_FL, "hashonly"}
};
/* Return a positive number < 0xff indicating the encoding magic number
diff --git a/man/mkfs.f2fs.8 b/man/mkfs.f2fs.8
index 8b3b0cc..b57f033 100644
--- a/man/mkfs.f2fs.8
+++ b/man/mkfs.f2fs.8
@@ -232,10 +232,16 @@ Use UTF-8 for casefolding.
.I flags:
.RS 1.2i
.TP 1.2i
-.B strict
+.B [no]strict
This flag specifies that invalid strings should be rejected by the filesystem.
Default is disabled.
.RE
+.RS 1.2i
+.TP 1.2i
+.B [no]hashonly
+This flag specifies that there is no linear lookup fallback during lookup.
+By default, linear lookup fallback is enabled.
+.RE
.RE
.TP
.BI \-q
--
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] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] mkfs.f2fs: support -C [no]hashonly to control linear lookup fallback
2025-07-24 3:56 [f2fs-dev] [PATCH] mkfs.f2fs: support -C [no]hashonly to control linear lookup fallback Chao Yu via Linux-f2fs-devel
@ 2025-07-24 15:06 ` Jaegeuk Kim via Linux-f2fs-devel
2025-07-24 15:55 ` Chao Yu via Linux-f2fs-devel
0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2025-07-24 15:06 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-f2fs-devel
Can we disable linear lookup by default, but add an option to enable it?
On 07/24, Chao Yu wrote:
> It provides a way to disable linear lookup fallback during mkfs.
>
> Usage:
>
> 1. Disable linear lookup:
> 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]
>
> 2. Enable linear lookup:
> 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]
>
> mkfs.f2fs -f -O casefold -C utf8 /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>
> ---
> lib/libf2fs.c | 1 +
> man/mkfs.f2fs.8 | 8 +++++++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 2f012c8..0e3e62a 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -1424,6 +1424,7 @@ static const struct enc_flags {
> char *param;
> } encoding_flags[] = {
> { F2FS_ENC_STRICT_MODE_FL, "strict" },
> + { F2FS_ENC_NO_COMPAT_FALLBACK_FL, "hashonly"}
> };
>
> /* Return a positive number < 0xff indicating the encoding magic number
> diff --git a/man/mkfs.f2fs.8 b/man/mkfs.f2fs.8
> index 8b3b0cc..b57f033 100644
> --- a/man/mkfs.f2fs.8
> +++ b/man/mkfs.f2fs.8
> @@ -232,10 +232,16 @@ Use UTF-8 for casefolding.
> .I flags:
> .RS 1.2i
> .TP 1.2i
> -.B strict
> +.B [no]strict
> This flag specifies that invalid strings should be rejected by the filesystem.
> Default is disabled.
> .RE
> +.RS 1.2i
> +.TP 1.2i
> +.B [no]hashonly
> +This flag specifies that there is no linear lookup fallback during lookup.
> +By default, linear lookup fallback is enabled.
> +.RE
> .RE
> .TP
> .BI \-q
> --
> 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 [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] mkfs.f2fs: support -C [no]hashonly to control linear lookup fallback
2025-07-24 15:06 ` Jaegeuk Kim via Linux-f2fs-devel
@ 2025-07-24 15:55 ` Chao Yu via Linux-f2fs-devel
0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-07-24 15:55 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On 7/24/2025 11:06 PM, Jaegeuk Kim wrote:
> Can we disable linear lookup by default, but add an option to enable it?
Sure.
>
> On 07/24, Chao Yu wrote:
>> It provides a way to disable linear lookup fallback during mkfs.
>>
>> Usage:
>>
>> 1. Disable linear lookup:
>> 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]
>>
>> 2. Enable linear lookup:
>> 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]
>>
>> mkfs.f2fs -f -O casefold -C utf8 /dev/vdb
>> dump.f2fs -d3 /dev/vdb |grep s_encoding_flags
>> s_encoding_flags [0x 0 : 0]
Let me update the logic to disable linear lookup by default for case 2.2).
1) mkfs.f2fs -f -O casefold -C utf8:hashonly /dev/vdb
2.1) mkfs.f2fs -f -O casefold -C utf8:nohashonly /dev/vdb
2.2) mkfs.f2fs -f -O casefold -C utf8 /dev/vdb
Thanks,
>>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>> lib/libf2fs.c | 1 +
>> man/mkfs.f2fs.8 | 8 +++++++-
>> 2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
>> index 2f012c8..0e3e62a 100644
>> --- a/lib/libf2fs.c
>> +++ b/lib/libf2fs.c
>> @@ -1424,6 +1424,7 @@ static const struct enc_flags {
>> char *param;
>> } encoding_flags[] = {
>> { F2FS_ENC_STRICT_MODE_FL, "strict" },
>> + { F2FS_ENC_NO_COMPAT_FALLBACK_FL, "hashonly"}
>> };
>>
>> /* Return a positive number < 0xff indicating the encoding magic number
>> diff --git a/man/mkfs.f2fs.8 b/man/mkfs.f2fs.8
>> index 8b3b0cc..b57f033 100644
>> --- a/man/mkfs.f2fs.8
>> +++ b/man/mkfs.f2fs.8
>> @@ -232,10 +232,16 @@ Use UTF-8 for casefolding.
>> .I flags:
>> .RS 1.2i
>> .TP 1.2i
>> -.B strict
>> +.B [no]strict
>> This flag specifies that invalid strings should be rejected by the filesystem.
>> Default is disabled.
>> .RE
>> +.RS 1.2i
>> +.TP 1.2i
>> +.B [no]hashonly
>> +This flag specifies that there is no linear lookup fallback during lookup.
>> +By default, linear lookup fallback is enabled.
>> +.RE
>> .RE
>> .TP
>> .BI \-q
>> --
>> 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 [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-24 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 3:56 [f2fs-dev] [PATCH] mkfs.f2fs: support -C [no]hashonly to control linear lookup fallback Chao Yu via Linux-f2fs-devel
2025-07-24 15:06 ` Jaegeuk Kim via Linux-f2fs-devel
2025-07-24 15:55 ` 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).