Re: [PATCH v3 06/13] ceph: move fscrypt to filesystem inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 22, 2025 at 01:14:06PM -0700, Eric Biggers wrote:
> On Tue, Jul 22, 2025 at 09:27:24PM +0200, Christian Brauner wrote:
> > 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
> 
> Why netfs_inode instead of ceph_inode_info?

If we add asserts that struct inode must be located at the beginning of
struct netfs_inode then I would feel comfortable doing that. I'll do
that.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux