[PATCH v3 11/13] ext4: move fsverity to filesystem inode

Christian Brauner
2025-07-22T19:28:25Z

Move fsverity data pointer into the filesystem's private inode and
record the offset from the embedded struct inode.

This will allow us to drop the fsverity data pointer from struct inode
itself and move it into the filesystem's inode.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/ext4/ext4.h | 4 ++++
fs/ext4/super.c | 7 +++++++
2 files changed, 11 insertions(+)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f27d57aea316..4ae1a8aa8bac 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1201,6 +1201,10 @@ struct ext4_inode_info {
#ifdef CONFIG_FS_ENCRYPTION
struct fscrypt_inode_info *i_fscrypt_info;
#endif
+
+#ifdef CONFIG_FS_VERITY
+ struct fsverity_info *i_fsverity_info;
+#endif
};

/*
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2a03835b67d5..37ef8fa4ebeb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1414,6 +1414,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
spin_lock_init(&ei->i_fc_lock);
#ifdef CONFIG_FS_ENCRYPTION
ei->i_fscrypt_info = NULL;
+#endif
+#ifdef CONFIG_FS_VERITY
+ ei->i_fsverity_info = NULL;
#endif
return &ei->vfs_inode;
}
@@ -1613,6 +1616,10 @@ static const struct super_operations ext4_sops = {
#ifdef CONFIG_FS_ENCRYPTION
.i_fscrypt = offsetof(struct ext4_inode_info, i_fscrypt_info) -
offsetof(struct ext4_inode_info, vfs_inode),
+#endif
+#ifdef CONFIG_FS_VERITY
+ .i_fsverity = offsetof(struct ext4_inode_info, i_fsverity_info) -
+ offsetof(struct ext4_inode_info, vfs_inode),
#endif
.alloc_inode = ext4_alloc_inode,
.free_inode = ext4_free_in_core_inode,

--
2.47.2