Messages in this thread | | | Date | Sun, 3 May 1998 10:12:12 +1000 | From | Richard Gooch <> | Subject | Re: dcache |
| |
Magnus Ahltorp writes: > Negative caching is done when deleting files, but I cannot see any > negative caching when lookup returns ENOENT. Is there a reason why this > feature is not implemented? It speeds up things like compiling and make > quite a bit.
You're right, if lookup() returns an error, then the dentry is freed and hence there is no negative dentry. However...
> If I want to implement this feature in my filesystem, does anyone have any > bright ideas on how to do it, like d_allocing my own dentry, leaving the > inode == NULL and do a d_add?
You don't need to allocate a new dentry. You simply need to do: d_add (dentry, NULL);
on the existing dentry that was passed to lookup().
So, you see, a filesystem has the choice of whether to "return" a negative dentry or remove the dentry. If you look at the ext2 FS implementation, you'll see that it's lookup() method will "return" a negative dentry. So in fact it's doing what you want.
Also note that most filesystems *must* return negative dentries, otherwise create(2), mknod(2), mkdir(2) and other system calls which create inodes would fail. Only a read-only filesystem could safely return an error in it's lookup() method.
Regards,
Richard....
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |