Skip to content

Commit c9fff80

Browse files
Eric Biggersbrauner
authored andcommitted
ext4: 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 ext4_inode_info::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-10-ebiggers@kernel.org Acked-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 2a7349a commit c9fff80

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

fs/ext4/ext4.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ struct ext4_inode_info {
11861186
#ifdef CONFIG_FS_ENCRYPTION
11871187
struct fscrypt_inode_info *i_crypt_info;
11881188
#endif
1189+
1190+
#ifdef CONFIG_FS_VERITY
1191+
struct fsverity_info *i_verity_info;
1192+
#endif
11891193
};
11901194

11911195
/*

fs/ext4/super.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,9 @@ static void init_once(void *foo)
14731473
#ifdef CONFIG_FS_ENCRYPTION
14741474
ei->i_crypt_info = NULL;
14751475
#endif
1476+
#ifdef CONFIG_FS_VERITY
1477+
ei->i_verity_info = NULL;
1478+
#endif
14761479
}
14771480

14781481
static int __init init_inodecache(void)

fs/ext4/verity.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ static int ext4_write_merkle_tree_block(struct inode *inode, const void *buf,
389389
}
390390

391391
const struct fsverity_operations ext4_verityops = {
392+
.inode_info_offs = (int)offsetof(struct ext4_inode_info, i_verity_info) -
393+
(int)offsetof(struct ext4_inode_info, vfs_inode),
392394
.begin_enable_verity = ext4_begin_enable_verity,
393395
.end_enable_verity = ext4_end_enable_verity,
394396
.get_verity_descriptor = ext4_get_verity_descriptor,

0 commit comments

Comments
 (0)