mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 05:22:19 -04:00
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>
This commit is contained in:
committed by
Christian Brauner
parent
1f66cef4a9
commit
fcafdd4210
@@ -338,6 +338,11 @@ struct btrfs_inode {
|
||||
struct list_head delayed_iput;
|
||||
|
||||
struct rw_semaphore i_mmap_lock;
|
||||
|
||||
#ifdef CONFIG_FS_VERITY
|
||||
struct fsverity_info *i_verity_info;
|
||||
#endif
|
||||
|
||||
struct inode vfs_inode;
|
||||
};
|
||||
|
||||
|
||||
@@ -7961,6 +7961,9 @@ static void init_once(void *foo)
|
||||
struct btrfs_inode *ei = foo;
|
||||
|
||||
inode_init_once(&ei->vfs_inode);
|
||||
#ifdef CONFIG_FS_VERITY
|
||||
ei->i_verity_info = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void __cold btrfs_destroy_cachep(void)
|
||||
|
||||
@@ -802,6 +802,8 @@ static int btrfs_write_merkle_tree_block(struct inode *inode, const void *buf,
|
||||
}
|
||||
|
||||
const struct fsverity_operations btrfs_verityops = {
|
||||
.inode_info_offs = (int)offsetof(struct btrfs_inode, i_verity_info) -
|
||||
(int)offsetof(struct btrfs_inode, vfs_inode),
|
||||
.begin_enable_verity = btrfs_begin_enable_verity,
|
||||
.end_enable_verity = btrfs_end_enable_verity,
|
||||
.get_verity_descriptor = btrfs_get_verity_descriptor,
|
||||
|
||||
Reference in New Issue
Block a user