]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: move verity info pointer to fs-specific part of inode
authorEric Biggers <ebiggers@kernel.org>
Sun, 10 Aug 2025 07:57:03 +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 f2fs_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-11-ebiggers@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/super.c
fs/f2fs/verity.c

index 2f5c30c069c3cac3558f91c9186d9ae5a29725fc..6e465bbc85ee5c537de9bd000aa822e8dcb79fff 100644 (file)
@@ -910,6 +910,9 @@ struct f2fs_inode_info {
 #ifdef CONFIG_FS_ENCRYPTION
        struct fscrypt_inode_info *i_crypt_info; /* filesystem encryption info */
 #endif
+#ifdef CONFIG_FS_VERITY
+       struct fsverity_info *i_verity_info; /* filesystem verity info */
+#endif
 };
 
 static inline void get_read_extent_info(struct extent_info *ext,
index b42b55280d9e389e19f7238ff1a861639d3994ab..1db024b20e29b4c99327b75f51db31a9c14f9e84 100644 (file)
@@ -483,6 +483,9 @@ static void init_once(void *foo)
 #ifdef CONFIG_FS_ENCRYPTION
        fi->i_crypt_info = NULL;
 #endif
+#ifdef CONFIG_FS_VERITY
+       fi->i_verity_info = NULL;
+#endif
 }
 
 #ifdef CONFIG_QUOTA
index 2287f238ae09eb46644d28e594682786d244e16f..f0ab9a3c7a82b368a13b6a6961a2d803e52c4b0a 100644 (file)
@@ -287,6 +287,8 @@ static int f2fs_write_merkle_tree_block(struct inode *inode, const void *buf,
 }
 
 const struct fsverity_operations f2fs_verityops = {
+       .inode_info_offs        = (int)offsetof(struct f2fs_inode_info, i_verity_info) -
+                                 (int)offsetof(struct f2fs_inode_info, vfs_inode),
        .begin_enable_verity    = f2fs_begin_enable_verity,
        .end_enable_verity      = f2fs_end_enable_verity,
        .get_verity_descriptor  = f2fs_get_verity_descriptor,