From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Daniel Lee <chullee@google.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: add sysfs entry for effective lookup mode
Date: Mon, 4 Aug 2025 14:36:04 +0800 [thread overview]
Message-ID: <785306c5-27ba-4a18-b702-1d943c484a56@kernel.org> (raw)
In-Reply-To: <20250804060327.512247-2-chullee@google.com>
On 8/4/25 14:03, Daniel Lee wrote:
> This commit introduces a new read-only sysfs entry at
> /sys/fs/f2fs/<device>/effective_lookup_mode.
>
> This entry displays the actual directory lookup mode F2FS is
> currently using. This is needed for debugging and verification,
> as the behavior is determined by both on-disk flags and mount
> options.
>
> Signed-off-by: Daniel Lee <chullee@google.com>
> ---
> Documentation/ABI/testing/sysfs-fs-f2fs | 14 ++++++++++++++
> fs/f2fs/sysfs.c | 18 ++++++++++++++++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index bf03263b9f46..e847a50e7403 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -861,3 +861,17 @@ Description: This is a read-only entry to show the value of sb.s_encoding_flags,
> SB_ENC_STRICT_MODE_FL 0x00000001
> SB_ENC_NO_COMPAT_FALLBACK_FL 0x00000002
> ============================ ==========
> +
> +What: /sys/fs/f2fs/<disk>/effective_lookup_mode
> +Date: August 2025
> +Contact: "Daniel Lee" <chullee@google.com>
> +Description:
> + This is a read-only entry to show the effective directory lookup mode
> + F2FS is currently using for casefolded directories.
> + This considers both the "lookup_mode" mount option and the on-disk
> + encoding flag, SB_ENC_NO_COMPAT_FALLBACK_FL.
> +
> + Possible values are:
> + - "perf": Hash-only lookup.
> + - "compat": Hash-based lookup with a linear search fallback enabled
> + for casefolded directories.
Any way to know whether "perf" or "compat" comes from auto mode or not? something
like "auto:perf", "auto:compat", maybe?
Thanks,
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 75134d69a0bd..9897dd8564e0 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -281,6 +281,22 @@ static ssize_t encoding_flags_show(struct f2fs_attr *a,
> le16_to_cpu(F2FS_RAW_SUPER(sbi)->s_encoding_flags));
> }
>
> +static ssize_t effective_lookup_mode_show(struct f2fs_attr *a,
> + struct f2fs_sb_info *sbi, char *buf)
> +{
> + switch (f2fs_get_lookup_mode(sbi)) {
> + case LOOKUP_PERF:
> + return sysfs_emit(buf, "perf\n");
> + case LOOKUP_COMPAT:
> + return sysfs_emit(buf, "compat\n");
> + case LOOKUP_AUTO:
> + if (sb_no_casefold_compat_fallback(sbi->sb))
> + return sysfs_emit(buf, "perf\n");
> + return sysfs_emit(buf, "compat\n");
> + }
> + return 0;
> +}
> +
> static ssize_t mounted_time_sec_show(struct f2fs_attr *a,
> struct f2fs_sb_info *sbi, char *buf)
> {
> @@ -1166,6 +1182,7 @@ F2FS_GENERAL_RO_ATTR(current_reserved_blocks);
> F2FS_GENERAL_RO_ATTR(unusable);
> F2FS_GENERAL_RO_ATTR(encoding);
> F2FS_GENERAL_RO_ATTR(encoding_flags);
> +F2FS_GENERAL_RO_ATTR(effective_lookup_mode);
> F2FS_GENERAL_RO_ATTR(mounted_time_sec);
> F2FS_GENERAL_RO_ATTR(main_blkaddr);
> F2FS_GENERAL_RO_ATTR(pending_discard);
> @@ -1282,6 +1299,7 @@ static struct attribute *f2fs_attrs[] = {
> ATTR_LIST(current_reserved_blocks),
> ATTR_LIST(encoding),
> ATTR_LIST(encoding_flags),
> + ATTR_LIST(effective_lookup_mode),
> ATTR_LIST(mounted_time_sec),
> #ifdef CONFIG_F2FS_STAT_FS
> ATTR_LIST(cp_foreground_calls),
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2025-08-04 6:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 6:03 [f2fs-dev] [PATCH 1/2] f2fs: add lookup_mode mount option Daniel Lee via Linux-f2fs-devel
2025-08-04 6:03 ` [f2fs-dev] [PATCH 2/2] f2fs: add sysfs entry for effective lookup mode Daniel Lee via Linux-f2fs-devel
2025-08-04 6:36 ` Chao Yu via Linux-f2fs-devel [this message]
2025-08-04 6:32 ` [f2fs-dev] [PATCH 1/2] f2fs: add lookup_mode mount option Chao Yu via Linux-f2fs-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=785306c5-27ba-4a18-b702-1d943c484a56@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=chullee@google.com \
--cc=jaegeuk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).