Skip to content

Commit bbe395d

Browse files
Eric Biggersbrauner
authored andcommitted
ceph: move crypt info pointer to fs-specific part of inode
Move the fscrypt_inode_info pointer into the filesystem-specific part of the inode by adding the field ceph_inode_info::i_crypt_info and configuring fscrypt_operations::inode_info_offs accordingly. This is a prerequisite for a later commit that removes inode::i_crypt_info, saving memory and improving cache efficiency with filesystems that don't support fscrypt. Co-developed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Link: https://lore.kernel.org/20250810075706.172910-7-ebiggers@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent e1add70 commit bbe395d

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

fs/ceph/crypto.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
133133
}
134134

135135
static struct fscrypt_operations ceph_fscrypt_ops = {
136+
.inode_info_offs = (int)offsetof(struct ceph_inode_info, i_crypt_info) -
137+
(int)offsetof(struct ceph_inode_info, netfs.inode),
136138
.needs_bounce_pages = 1,
137139
.get_context = ceph_crypt_get_context,
138140
.set_context = ceph_crypt_set_context,

fs/ceph/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
665665
ci->i_work_mask = 0;
666666
memset(&ci->i_btime, '\0', sizeof(ci->i_btime));
667667
#ifdef CONFIG_FS_ENCRYPTION
668+
ci->i_crypt_info = NULL;
668669
ci->fscrypt_auth = NULL;
669670
ci->fscrypt_auth_len = 0;
670671
#endif

fs/ceph/super.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ struct ceph_inode_info {
463463
unsigned long i_work_mask;
464464

465465
#ifdef CONFIG_FS_ENCRYPTION
466+
struct fscrypt_inode_info *i_crypt_info;
466467
u32 fscrypt_auth_len;
467468
u32 fscrypt_file_len;
468469
u8 *fscrypt_auth;

0 commit comments

Comments
 (0)