[PATCH v3 12/13] f2fs: move fsverity to filesystem inode

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

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/f2fs/f2fs.h | 3 +++
fs/f2fs/super.c | 7 +++++++
2 files changed, 10 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 14e69c00e679..dc43a957a693 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -908,6 +908,9 @@ struct f2fs_inode_info {
#ifdef CONFIG_FS_ENCRYPTION
struct fscrypt_inode_info *i_fscrypt_info; /* filesystem encryption info */
#endif
+#ifdef CONFIG_FS_VERITY
+ struct fsverity_info *i_fsverity_info;
+#endif
};

static inline void get_read_extent_info(struct extent_info *ext,
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 969ba46990ea..75e7661be462 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1456,6 +1456,9 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
#ifdef CONFIG_FS_ENCRYPTION
fi->i_fscrypt_info = NULL;
#endif
+#ifdef CONFIG_FS_VERITY
+ fi->i_fsverity_info = NULL;
+#endif

return &fi->vfs_inode;
}
@@ -3252,6 +3255,10 @@ static const struct super_operations f2fs_sops = {
#ifdef CONFIG_FS_ENCRYPTION
.i_fscrypt = offsetof(struct f2fs_inode_info, i_fscrypt_info) -
offsetof(struct f2fs_inode_info, vfs_inode),
+#endif
+#ifdef CONFIG_FS_VERITY
+ .i_fsverity = offsetof(struct f2fs_inode_info, i_fsverity_info) -
+ offsetof(struct f2fs_inode_info, vfs_inode),
#endif
.alloc_inode = f2fs_alloc_inode,
.free_inode = f2fs_free_inode,

--
2.47.2