Re: [cocci] [RFC PATCH 0/6] debugfs: Replace dentry with an opaque handle in debugfs API

Steven Rostedt
2025-02-10T17:12:51Z

On Mon, 10 Feb 2025 17:00:16 +0000
Al Viro <viro@zeniv.linux.org.uk> wrote:

> On Mon, Feb 10, 2025 at 11:53:13AM -0500, Steven Rostedt wrote:
>
> > 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 disagree, actually - kernfs is an awful model for anything, sysfs included...

Then what would you suggest? It's the only generic system that is
appropriate for control features, where the underlining "files" are
actually functions to modify or query information from the kernel.

The entire VFS layer is designed for efficient management of some kind of
storage device, where the only interaction with the storage device is
through VFS.

For pseudo file systems like debugfs, sysfs and tracefs, the underlining
"storage" is the kernel itself, where we need a way for the "storage" part
to work with the kernel. The VFS layer doesn't give that, which is why
debugfs and tracefs used dentry as that interface, as the dentry does
represent the underlining storage.

From what I understand (and Christian can correct me), is that kernfs was
created to be that interface of the "storage" connecting back to the
kernel. Where the VFS layer deals with the user accessing the file system
(read, write, mkdir, etc) but kernfs is the "data storage" that attaches
those call back to the kernel to retrieve kernel information or even modify
the kernel behavior.

-- Steve