On Thu, 4 Jan 2024 01:48:37 +0000
Al Viro [off-list ref] wrote:
On Wed, Jan 03, 2024 at 08:32:46PM -0500, Steven Rostedt wrote:
quoted
+ /* Get the tracefs root from the parent */
+ inode = d_inode(dentry->d_parent);
+ inode = d_inode(inode->i_sb->s_root);
That makes no sense. First of all, for any positive dentry we have
dentry->d_sb == dentry->d_inode->i_sb. And it's the same for all
dentries on given superblock. So what's the point of that dance?
If you want the root inode, just go for d_inode(dentry->d_sb->s_root)
and be done with that...
That was more of thinking that the dentry and dentry->d_parent are
different. As dentry is part of eventfs and dentry->d_parent is part of
tracefs. Currently they both have the same superblock so yeah, I could just
write it that way too and it would work. But in my head, I was thinking
that they behave differently and maybe one day eventfs would get its own
superblock which would not work.
To explain this better:
/sys/kernel/tracing/ is the parent of /sys/kernel/tracing/events
But everything but "events" in /sys/kernel/tracing/* is part of tracefs.
Everything in /sys/kernel/tracing/events is part of eventfs.
That was my thought process. But as both tracefs and eventfs still use
tracefs_get_inode(), it would work as you state.
I'll update that, as I don't foresee that eventfs will become its own file
system.
Thanks,
-- Steve