Re: [PATCH v3 01/13] fs: add fscrypt offset

Eric Biggers
2025-07-22T20:02:28Z

On Tue, Jul 22, 2025 at 09:27:19PM +0200, Christian Brauner wrote:
> Store the offset of the fscrypt data pointer from struct inode in struct
> super_operations. Both are embedded in the filesystem's private 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@kernel.org>
> ---
> include/linux/fs.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 96c7925a6551..991089969e71 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2332,6 +2332,7 @@ enum freeze_holder {
> };
>
> struct super_operations {
> + ptrdiff_t i_fscrypt;
> struct inode *(*alloc_inode)(struct super_block *sb);
> void (*destroy_inode)(struct inode *);
> void (*free_inode)(struct inode *);

If using inode_operations was ruled out, so we have to go through the
super_block to get to an operations struct anyway, wouldn't it make more
sense to use fscrypt_operations and fsverity_operations? They are
accessible as inode->i_sb->s_cop and inode->i_sb->s_vop. Same number of
dereferences as getting to inode->i_sb->s_op.

For the naming, how about fscrypt_operations::inode_info_offs and
fsverity_operations::inode_info_offs?

- Eric