Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Eric Biggers and committed by
Christian Brauner
ab90c2d2 bbe395de

+6 -7
-5
include/linux/fs.h
··· 72 72 struct seq_file; 73 73 struct workqueue_struct; 74 74 struct iov_iter; 75 - struct fscrypt_inode_info; 76 75 struct fscrypt_operations; 77 76 struct fsverity_info; 78 77 struct fsverity_operations; ··· 777 778 __u32 i_fsnotify_mask; /* all events this inode cares about */ 778 779 /* 32-bit hole reserved for expanding i_fsnotify_mask */ 779 780 struct fsnotify_mark_connector __rcu *i_fsnotify_marks; 780 - #endif 781 - 782 - #ifdef CONFIG_FS_ENCRYPTION 783 - struct fscrypt_inode_info *i_crypt_info; 784 781 #endif 785 782 786 783 #ifdef CONFIG_FS_VERITY
+6 -2
include/linux/fscrypt.h
··· 201 201 int fscrypt_d_revalidate(struct inode *dir, const struct qstr *name, 202 202 struct dentry *dentry, unsigned int flags); 203 203 204 + /* 205 + * Returns the address of the fscrypt info pointer within the 206 + * filesystem-specific part of the inode. (To save memory on filesystems that 207 + * don't support fscrypt, a field in 'struct inode' itself is no longer used.) 208 + */ 204 209 static inline struct fscrypt_inode_info ** 205 210 fscrypt_inode_info_addr(const struct inode *inode) 206 211 { 207 - if (inode->i_sb->s_cop->inode_info_offs == 0) 208 - return (struct fscrypt_inode_info **)&inode->i_crypt_info; 212 + VFS_WARN_ON_ONCE(inode->i_sb->s_cop->inode_info_offs == 0); 209 213 return (void *)inode + inode->i_sb->s_cop->inode_info_offs; 210 214 } 211 215