[f2fs-dev] fsverity optimzations and speedups

Christoph Hellwig
2026-01-19T06:23:13Z

Hi all,

this series has a hodge podge of fsverity enhances that I looked into as
part of the review of the xfs fsverity support series.

The first three patches call fsverity code from VFS code instead of
requiring a lot of boilerplate in the file systems. The first fixes a
bug in btrfs as part of that, as btrfs was missing a check. An xfstests
test case for this will be sent separately.

Patch 4 removes the need to have a pointer to the fsverity_info in the
inode structure and uses a global resizable hash table instead.

Patch 5 passes down the struct file in the write path.

Patch 6 optimizes the fsvvrity read path by kicking off readahead for the
fsverity hashes from the data read submission context, which in my
simply testing showed huge benefits for sequential reads using dd.
I haven't been able to get fio to run on a preallocated fio file, but
I expect random read benefits would be significantly better than that
still.

Diffstat:
fs/attr.c | 12 +++
fs/btrfs/btrfs_inode.h | 4 -
fs/btrfs/file.c | 6 -
fs/btrfs/inode.c | 13 ---
fs/btrfs/verity.c | 11 +--
fs/ext4/ext4.h | 4 -
fs/ext4/file.c | 4 -
fs/ext4/inode.c | 4 -
fs/ext4/readpage.c | 4 +
fs/ext4/super.c | 4 -
fs/ext4/verity.c | 34 ++++-----
fs/f2fs/data.c | 4 +
fs/f2fs/f2fs.h | 3
fs/f2fs/file.c | 8 --
fs/f2fs/inode.c | 1
fs/f2fs/super.c | 3
fs/f2fs/verity.c | 34 ++++-----
fs/inode.c | 9 ++
fs/open.c | 8 +-
fs/verity/enable.c | 39 ++++++-----
fs/verity/fsverity_private.h | 17 ++--
fs/verity/open.c | 90 ++++++++++++++-----------
fs/verity/read_metadata.c | 10 +-
fs/verity/verify.c | 98 +++++++++++++++++++--------
include/linux/fsverity.h | 152 +++++++++----------------------------------
25 files changed, 262 insertions(+), 314 deletions(-)