]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: add lookup_mode mount option
authorDaniel Lee <chullee@google.com>
Tue, 5 Aug 2025 06:52:26 +0000 (23:52 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 11 Aug 2025 17:03:27 +0000 (17:03 +0000)
commit632f0b6c3e32758e5c93d4e3c2860a3708b9853e
tree9d00826c7f18a06d5f13c55fe77017112d4b1eef
parent76bb6a72bc1daa3d973395349f366231768f8877
f2fs: add lookup_mode mount option

For casefolded directories, f2fs may fall back to a linear search if
a hash-based lookup fails. This can cause severe performance
regressions.

While this behavior can be controlled by userspace tools (e.g. mkfs,
fsck) by setting an on-disk flag, a kernel-level solution is needed
to guarantee the lookup behavior regardless of the on-disk state.

This commit introduces the 'lookup_mode' mount option to provide this
kernel-side control.

The option accepts three values:
- perf: (Default) Enforces a hash-only lookup. The linear fallback
  is always disabled.
- compat: Enables the linear search fallback for compatibility with
  directory entries from older kernels.
- auto: Determines the mode based on the on-disk flag, preserving the
  userspace-based behavior.

Signed-off-by: Daniel Lee <chullee@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Documentation/filesystems/f2fs.rst
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/super.c