fs: remove inode::i_crypt_info
Now that all fscrypt-capable filesystems store the pointer to fscrypt_inode_info in the filesystem-specific part of the inode structure, inode::i_crypt_info is no longer needed. Update fscrypt_inode_info_addr() to no longer support the fallback to inode::i_crypt_info. Finally, remove inode::i_crypt_info itself along with the now-unnecessary forward declaration of fscrypt_inode_info. The end result of the migration to the filesystem-specific pointer is memory savings on CONFIG_FS_ENCRYPTION=y kernels for all filesystems that don't support fscrypt. Specifically, their in-memory inodes are now smaller by the size of a pointer: either 4 or 8 bytes. Co-developed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Link: https://lore.kernel.org/20250810075706.172910-8-ebiggers@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>pull/1354/merge
parent
bbe395ded3
commit
ab90c2d247
|
|
@ -72,7 +72,6 @@ struct swap_info_struct;
|
||||||
struct seq_file;
|
struct seq_file;
|
||||||
struct workqueue_struct;
|
struct workqueue_struct;
|
||||||
struct iov_iter;
|
struct iov_iter;
|
||||||
struct fscrypt_inode_info;
|
|
||||||
struct fscrypt_operations;
|
struct fscrypt_operations;
|
||||||
struct fsverity_info;
|
struct fsverity_info;
|
||||||
struct fsverity_operations;
|
struct fsverity_operations;
|
||||||
|
|
@ -780,10 +779,6 @@ struct inode {
|
||||||
struct fsnotify_mark_connector __rcu *i_fsnotify_marks;
|
struct fsnotify_mark_connector __rcu *i_fsnotify_marks;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FS_ENCRYPTION
|
|
||||||
struct fscrypt_inode_info *i_crypt_info;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_FS_VERITY
|
#ifdef CONFIG_FS_VERITY
|
||||||
struct fsverity_info *i_verity_info;
|
struct fsverity_info *i_verity_info;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -201,11 +201,15 @@ struct fscrypt_operations {
|
||||||
int fscrypt_d_revalidate(struct inode *dir, const struct qstr *name,
|
int fscrypt_d_revalidate(struct inode *dir, const struct qstr *name,
|
||||||
struct dentry *dentry, unsigned int flags);
|
struct dentry *dentry, unsigned int flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the address of the fscrypt info pointer within the
|
||||||
|
* filesystem-specific part of the inode. (To save memory on filesystems that
|
||||||
|
* don't support fscrypt, a field in 'struct inode' itself is no longer used.)
|
||||||
|
*/
|
||||||
static inline struct fscrypt_inode_info **
|
static inline struct fscrypt_inode_info **
|
||||||
fscrypt_inode_info_addr(const struct inode *inode)
|
fscrypt_inode_info_addr(const struct inode *inode)
|
||||||
{
|
{
|
||||||
if (inode->i_sb->s_cop->inode_info_offs == 0)
|
VFS_WARN_ON_ONCE(inode->i_sb->s_cop->inode_info_offs == 0);
|
||||||
return (struct fscrypt_inode_info **)&inode->i_crypt_info;
|
|
||||||
return (void *)inode + inode->i_sb->s_cop->inode_info_offs;
|
return (void *)inode + inode->i_sb->s_cop->inode_info_offs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue