Unverified Commit fcafdd42 authored by Eric Biggers's avatar Eric Biggers Committed by Christian Brauner
Browse files

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: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarEric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/20250810075706.172910-12-ebiggers@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 1f66cef4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
};

+3 −0
Original line number Diff line number Diff line
@@ -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)
+2 −0
Original line number Diff line number Diff line
@@ -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,