]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: move verity info pointer to fs-specific part of inode
authorEric Biggers <ebiggers@kernel.org>
Sun, 10 Aug 2025 07:57:02 +0000 (00:57 -0700)
committerChristian Brauner <brauner@kernel.org>
Thu, 21 Aug 2025 11:58:08 +0000 (13:58 +0200)
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>
fs/ext4/ext4.h
fs/ext4/super.c
fs/ext4/verity.c

index c897109dadb1572780432f2f667f54ccce2be75f..6cb784a56b3bab9d6dc6067b0587c2524124fd7b 100644 (file)
@@ -1186,6 +1186,10 @@ struct ext4_inode_info {
 #ifdef CONFIG_FS_ENCRYPTION
        struct fscrypt_inode_info *i_crypt_info;
 #endif
+
+#ifdef CONFIG_FS_VERITY
+       struct fsverity_info *i_verity_info;
+#endif
 };
 
 /*
index 0c3059ecce37ce9b79b867030022b3aacde25fab..46138a6cb32a3dfd84922656633b58ac71e3bf9b 100644 (file)
@@ -1473,6 +1473,9 @@ static void init_once(void *foo)
 #ifdef CONFIG_FS_ENCRYPTION
        ei->i_crypt_info = NULL;
 #endif
+#ifdef CONFIG_FS_VERITY
+       ei->i_verity_info = NULL;
+#endif
 }
 
 static int __init init_inodecache(void)
index d9203228ce97969a25a5469d16bea7859a29eebf..b0acb0c50313794979dab3701b1b90c7590cd5b7 100644 (file)
@@ -389,6 +389,8 @@ static int ext4_write_merkle_tree_block(struct inode *inode, const void *buf,
 }
 
 const struct fsverity_operations ext4_verityops = {
+       .inode_info_offs        = (int)offsetof(struct ext4_inode_info, i_verity_info) -
+                                 (int)offsetof(struct ext4_inode_info, vfs_inode),
        .begin_enable_verity    = ext4_begin_enable_verity,
        .end_enable_verity      = ext4_end_enable_verity,
        .get_verity_descriptor  = ext4_get_verity_descriptor,