Skip to content

Commit 1f66cef

Browse files
Eric Biggersbrauner
authored andcommitted
f2fs: 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 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>
1 parent c9fff80 commit 1f66cef

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

fs/f2fs/f2fs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,9 @@ struct f2fs_inode_info {
910910
#ifdef CONFIG_FS_ENCRYPTION
911911
struct fscrypt_inode_info *i_crypt_info; /* filesystem encryption info */
912912
#endif
913+
#ifdef CONFIG_FS_VERITY
914+
struct fsverity_info *i_verity_info; /* filesystem verity info */
915+
#endif
913916
};
914917

915918
static inline void get_read_extent_info(struct extent_info *ext,

fs/f2fs/super.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ static void init_once(void *foo)
483483
#ifdef CONFIG_FS_ENCRYPTION
484484
fi->i_crypt_info = NULL;
485485
#endif
486+
#ifdef CONFIG_FS_VERITY
487+
fi->i_verity_info = NULL;
488+
#endif
486489
}
487490

488491
#ifdef CONFIG_QUOTA

fs/f2fs/verity.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ static int f2fs_write_merkle_tree_block(struct inode *inode, const void *buf,
287287
}
288288

289289
const struct fsverity_operations f2fs_verityops = {
290+
.inode_info_offs = (int)offsetof(struct f2fs_inode_info, i_verity_info) -
291+
(int)offsetof(struct f2fs_inode_info, vfs_inode),
290292
.begin_enable_verity = f2fs_begin_enable_verity,
291293
.end_enable_verity = f2fs_end_enable_verity,
292294
.get_verity_descriptor = f2fs_get_verity_descriptor,

0 commit comments

Comments
 (0)