Skip to content

Commit fcafdd4

Browse files
Eric Biggersbrauner
authored andcommitted
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>
1 parent 1f66cef commit fcafdd4

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

fs/btrfs/btrfs_inode.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ struct btrfs_inode {
338338
struct list_head delayed_iput;
339339

340340
struct rw_semaphore i_mmap_lock;
341+
342+
#ifdef CONFIG_FS_VERITY
343+
struct fsverity_info *i_verity_info;
344+
#endif
345+
341346
struct inode vfs_inode;
342347
};
343348

fs/btrfs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7961,6 +7961,9 @@ static void init_once(void *foo)
79617961
struct btrfs_inode *ei = foo;
79627962

79637963
inode_init_once(&ei->vfs_inode);
7964+
#ifdef CONFIG_FS_VERITY
7965+
ei->i_verity_info = NULL;
7966+
#endif
79647967
}
79657968

79667969
void __cold btrfs_destroy_cachep(void)

fs/btrfs/verity.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ static int btrfs_write_merkle_tree_block(struct inode *inode, const void *buf,
802802
}
803803

804804
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),
805807
.begin_enable_verity = btrfs_begin_enable_verity,
806808
.end_enable_verity = btrfs_end_enable_verity,
807809
.get_verity_descriptor = btrfs_get_verity_descriptor,

0 commit comments

Comments
 (0)