On Mon, 7 Oct 2024 at 12:22, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > Maybe it is more straightforward, I can go with that, but it > feels like a waste not to use the space in backing_file, > so let me first try to convince you otherwise. Is it not a much bigger waste to allocate backing_file with kmalloc() instead of kmem_cache_alloc()? > IMO, this is not a layer violation at all. > The way I perceive struct backing_file is as an inheritance from struct file, > similar to the way that ovl_inode is an inheritance from vfs_inode. That sounds about right. > You can say that backing_file_user_path() is the layer violation, having > the vfs peek into the ovl layer above it, but backing_file_private_ptr() > is the opposite - it is used only by the layer that allocated backing_file, > so it is just like saying that a struct file has a single private_data, while > the inherited generic backing_file can store two private_data pointers. > > What's wrong with that? It feels wrong to me, because lowerfile's backing_file is just a convenient place to stash a completely unrelated pointer into. Furthermore private_data pointers lack type safety with all the problems that entails. Thanks, Miklos