Move fscrypt data pointer into the filesystem's private inode and record the offset from the embedded struct inode. This will allow us to drop the fscrypt data pointer from struct inode itself and move it into the filesystem's inode. Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> --- fs/ceph/super.c | 4 ++++ include/linux/netfs.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 2b8438d8a324..540b32e746de 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1039,6 +1039,10 @@ void ceph_umount_begin(struct super_block *sb) } static const struct super_operations ceph_super_ops = { +#ifdef CONFIG_FS_ENCRYPTION + .i_fscrypt = offsetof(struct ceph_inode_info, netfs.i_fscrypt_info) - + offsetof(struct ceph_inode_info, netfs.inode), +#endif .alloc_inode = ceph_alloc_inode, .free_inode = ceph_free_inode, .write_inode = ceph_write_inode, diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 065c17385e53..fda1321da861 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -57,6 +57,9 @@ typedef void (*netfs_io_terminated_t)(void *priv, ssize_t transferred_or_error); */ struct netfs_inode { struct inode inode; /* The VFS inode */ +#ifdef CONFIG_FS_ENCRYPTION + struct fscrypt_inode_info *i_fscrypt_info; +#endif const struct netfs_request_ops *ops; #if IS_ENABLED(CONFIG_FSCACHE) struct fscache_cookie *cache; @@ -503,6 +506,9 @@ static inline void netfs_inode_init(struct netfs_inode *ctx, ctx->zero_point = ctx->remote_i_size; mapping_set_release_always(ctx->inode.i_mapping); } +#ifdef CONFIG_FS_ENCRYPTION + ctx->i_fscrypt_info = NULL; +#endif } /** -- 2.47.2