Re: [PATCH] eventfs: Have inodes have unique inode numbers

From: Steven Rostedt
Date: Sun Jan 28 2024 - 17:51:28 EST


On Sat, 27 Jan 2024 13:47:32 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> There are tons of other 'ei->dentry' uses, and I didn't look at those.
> Baby steps. But this *seems* like an obvious cleanup, and many small
> obvious cleanups later and perhaps the 'ei->dentry' pointer (and the
> '->d_children[]' array) can eventually go away. They should all be
> entirely useless - there's really no reason for a filesystem to hold
> on to back-pointers of dentries.

I was working on getting rid of ei->dentry, but then I hit:

void eventfs_remove_dir(struct eventfs_inode *ei)
{
struct dentry *dentry;

if (!ei)
return;

mutex_lock(&eventfs_mutex);
dentry = ei->dentry;
eventfs_remove_rec(ei, 0);
mutex_unlock(&eventfs_mutex);

/*
* If any of the ei children has a dentry, then the ei itself
* must have a dentry.
*/
if (dentry)
simple_recursive_removal(dentry, NULL);
}

Where it deletes the all the existing dentries in a tree. Is this a
valid place to keep ei->dentry? I believe this is what makes the
directory disappear from the user's view. But the ei->dentry is there to
know that it is in the user's view to begin with.

-- Steve