Re: [PATCH RFC DRAFT DOESNOTBUILD] inode: free up more space

Christian Brauner
2025-07-16T12:20:01Z

On Wed, Jul 16, 2025 at 01:21:49PM +0200, Christoph Hellwig wrote:
> On Tue, Jul 15, 2025 at 04:35:24PM +0200, Christian Brauner wrote:
> > Unless there are severe performance penalties for the extra pointer
> > dereferences getting our hands on 16 bytes is a good reason to at least
> > consider doing this.
> >
> > I've drafted one way of doing this using ext4 as my victim^wexample. I'd
> > like to hear some early feedback whether this is something we would want
> > to pursue.
>
> I like getting rid of the fields. But adding all these indirect calls
> is a bit nasty.
>
> Given that all these fields should be in the file system specific inode
> that also embeddeds the vfs struct inode, what about just putting the
> relative offset into struct inode_operations.
>
> e.g. something like
>
> struct inode_operations {
> ...
> ptrdiff_t i_crypto_offset;
> }
>
> struct inode_operations foofs_iops {
> ...
>
> .i_crypto_offset = offsetoff(struct foofs_inode), vfs_inode) -
> offsetoff(struct foofs_inode, crypt_info);
> }
>
> static inline struct fscrypt_inode_info CRYPT_I(struct inode *inode)
> {
> return ((void *)inode) - inode->i_op->i_cryto_offset;
> }

Sheesh, ugly in a different way imho. I could live with it. I'll let
@Jan be the tie-breaker.

I've started working on this so best tell me soon... :)