On Mon, 10 Feb 2025 08:08:25 -0800 David Reaver <me@xxxxxxxxxxxxxxx> wrote: > Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> writes: > > > > > First off, many thanks for attempting this, I didn't think it was ready > > to even be attempted, so it's very nice to see this. > > > > No problem, and thank you for taking a look! > > > That being said, I agree with Al, we can't embed a dentry in a structure > > like that as the lifecycles are going to get messy fast. > > > > Ack, I'll do something different in v2. > > For my own education: what goes wrong with lifecycles with this embed? > Feel free to point me at a doc or something. > > Also, Al and Greg, would wrapping a pointer be fine? > > struct debugfs_node { > struct dentry *dentry; > }; No it will not be fine. You should not be using dentry at all. I thought this was going to convert debugfs over to kernfs. The debugfs_node should be using kernfs and completely eliminate the use of dentry. > > I was trying to do the simplest thing possible so the bulk of the change > was mechanical. Wrapping a pointer is slightly more complicated because > we have to deal with memory allocation, but it is still totally doable. > > > Also, your replacement of many of the dentry functions with wrappers > > seems at bit odd, ideally you would just return a dentry from a call > > like "debugfs_node_to_dentry()" and then let the caller do with it what > > it wants to, that way you don't need to wrap everything. What caller should ever touch a dentry? What I got from my "conversation" with Linus, is that dentry is an internal caching descriptor of the VFS layer, and should only be used by the VFS layer. Nothing outside of VFS should ever need a dentry. -- Steve