It seems that it shouldn't be too complex deciding when to free the
dentry: if iput() walks the dentry chain and sets a flag, then any
dentry with dcount == 0 and "may free" set can be freed. iput() can
just count the nodes on the i_dentry chain to get the correct dependency
count.
> Generally, I don't want those kinds of dependencies: at least in my
> opinion a circular dependency (inodes depend on dentries which depend on
> inodes) tends to drive complexity not up by two, but by a power of two..
Agreed that circular dependencies drive up complexity, but in this case
you've already done the hard work: the inode dentry chain shows what
dentries depend on an inode, and the dentry tree shows the dependency on
other dentries. When a leaf node satisfies d_count == 0 and "may free",
just chop it off and let the effects ripple through. The LRU stuff can
be added later once the basic operations are solid.
I guess my view is very "inode-centric", but I think the above approach
would work well with waht we've got, and could be implemented to be 100%
free of races.
Regards,
Bill