Messages in this thread | | | Date | Sun, 13 Jul 1997 14:54:03 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: pre-patch2.1.45-3 lookin' good |
| |
On Sun, 13 Jul 1997, Bill Hawes wrote: > > I don't fully understand the dcache/dentry code yet, but it seems to me > that the dentry could be freed any time after i_count decreases to equal > the number of dentry counts. So if dentries reference the inode 4 > times, when i_count drops to 4, it's time to think about freeing the > dentries (and thus eventually the inode.)
The above is roughly how the current code tries to work, except it's broken and assumes the number of dentries to be 1.
However, the problem with the code is that a dentry now depends on two things: both iput() and dput() can result in a dentry being free. And that is why the code is so complex: dput cannot on its own decide whether it can free stuff, it needs help from iput..
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..
Anyway, that's why I've been re-doing the logic so that dentries no longer depend on any inode information: when the dentry count goes down to zero we can always just free the dentry regardless of any inode counts (essentially because the inode count has now been relegated to be just a "dentry link count").
Linus
| |