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

btrfs: move verity info pointer to fs-specific part of inode

Move the fsverity_info pointer into the filesystem-specific part of the
inode by adding the field btrfs_inode::i_verity_info and configuring
fsverity_operations::inode_info_offs accordingly.

This is a prerequisite for a later commit that removes
inode::i_verity_info, saving memory and improving cache efficiency on
filesystems that don't support fsverity.

Co-developed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/20250810075706.172910-12-ebiggers@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Eric Biggers and committed by
Christian Brauner
fcafdd42 1f66cef4

+10
+5
fs/btrfs/btrfs_inode.h
··· 338 338 struct list_head delayed_iput; 339 339 340 340 struct rw_semaphore i_mmap_lock; 341 + 342 + #ifdef CONFIG_FS_VERITY 343 + struct fsverity_info *i_verity_info; 344 + #endif 345 + 341 346 struct inode vfs_inode; 342 347 }; 343 348
+3
fs/btrfs/inode.c
··· 7961 7961 struct btrfs_inode *ei = foo; 7962 7962 7963 7963 inode_init_once(&ei->vfs_inode); 7964 + #ifdef CONFIG_FS_VERITY 7965 + ei->i_verity_info = NULL; 7966 + #endif 7964 7967 } 7965 7968 7966 7969 void __cold btrfs_destroy_cachep(void)
+2
fs/btrfs/verity.c
··· 802 802 } 803 803 804 804 const struct fsverity_operations btrfs_verityops = { 805 + .inode_info_offs = (int)offsetof(struct btrfs_inode, i_verity_info) - 806 + (int)offsetof(struct btrfs_inode, vfs_inode), 805 807 .begin_enable_verity = btrfs_begin_enable_verity, 806 808 .end_enable_verity = btrfs_end_enable_verity, 807 809 .get_verity_descriptor = btrfs_get_verity_descriptor,