Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

f2fs: add sysfs entry for effective lookup mode

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>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Daniel Lee and committed by
Jaegeuk Kim
1bd119da 632f0b6c

+33
+15
Documentation/ABI/testing/sysfs-fs-f2fs
··· 883 883 Contact: "Daeho Jeong" <daehojeong@google.com> 884 884 Description: Control GC algorithm for boost GC. 0: cost benefit, 1: greedy 885 885 Default: 1 886 + 887 + What: /sys/fs/f2fs/<disk>/effective_lookup_mode 888 + Date: August 2025 889 + Contact: "Daniel Lee" <chullee@google.com> 890 + Description: 891 + This is a read-only entry to show the effective directory lookup mode 892 + F2FS is currently using for casefolded directories. 893 + This considers both the "lookup_mode" mount option and the on-disk 894 + encoding flag, SB_ENC_NO_COMPAT_FALLBACK_FL. 895 + 896 + Possible values are: 897 + - "perf": Hash-only lookup. 898 + - "compat": Hash-based lookup with a linear search fallback enabled 899 + - "auto:perf": lookup_mode is auto and fallback is disabled on-disk 900 + - "auto:compat": lookup_mode is auto and fallback is enabled on-disk
+18
fs/f2fs/sysfs.c
··· 281 281 le16_to_cpu(F2FS_RAW_SUPER(sbi)->s_encoding_flags)); 282 282 } 283 283 284 + static ssize_t effective_lookup_mode_show(struct f2fs_attr *a, 285 + struct f2fs_sb_info *sbi, char *buf) 286 + { 287 + switch (F2FS_OPTION(sbi).lookup_mode) { 288 + case LOOKUP_PERF: 289 + return sysfs_emit(buf, "perf\n"); 290 + case LOOKUP_COMPAT: 291 + return sysfs_emit(buf, "compat\n"); 292 + case LOOKUP_AUTO: 293 + if (sb_no_casefold_compat_fallback(sbi->sb)) 294 + return sysfs_emit(buf, "auto:perf\n"); 295 + return sysfs_emit(buf, "auto:compat\n"); 296 + } 297 + return 0; 298 + } 299 + 284 300 static ssize_t mounted_time_sec_show(struct f2fs_attr *a, 285 301 struct f2fs_sb_info *sbi, char *buf) 286 302 { ··· 1227 1211 F2FS_GENERAL_RO_ATTR(unusable); 1228 1212 F2FS_GENERAL_RO_ATTR(encoding); 1229 1213 F2FS_GENERAL_RO_ATTR(encoding_flags); 1214 + F2FS_GENERAL_RO_ATTR(effective_lookup_mode); 1230 1215 F2FS_GENERAL_RO_ATTR(mounted_time_sec); 1231 1216 F2FS_GENERAL_RO_ATTR(main_blkaddr); 1232 1217 F2FS_GENERAL_RO_ATTR(pending_discard); ··· 1346 1329 ATTR_LIST(current_reserved_blocks), 1347 1330 ATTR_LIST(encoding), 1348 1331 ATTR_LIST(encoding_flags), 1332 + ATTR_LIST(effective_lookup_mode), 1349 1333 ATTR_LIST(mounted_time_sec), 1350 1334 #ifdef CONFIG_F2FS_STAT_FS 1351 1335 ATTR_LIST(cp_foreground_calls),