Re: namei caching of newly created files?
Havard Eidnes <[email protected]> Thu, 20 Jan 2005 00:28:15 +0100 (CET)
| Newsgroups | gmane.os.netbsd.devel.kernel,gmane.os.netbsd.devel.performance |
|---|---|
| Message-ID | <[email protected]> |
Hm,
it seems that <sys/namei.h> already has cache_enter(). I wonder
if this patch looks sane and safe:
Index: vfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.85
diff -u -u -1 -0 -r1.85 vfs_vnops.c
--- vfs_vnops.c 2 Jan 2005 16:08:29 -0000 1.85
+++ vfs_vnops.c 19 Jan 2005 23:26:20 -0000
@@ -135,20 +135,21 @@
goto restart;
}
VOP_LEASE(ndp->ni_dvp, p, cred, LEASE_WRITE);
error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
&ndp->ni_cnd, &va);
vn_finished_write(mp, 0);
if (error)
return (error);
fmode &= ~O_TRUNC;
vp = ndp->ni_vp;
+ cache_enter(ndp->ni_dvp, vp, &ndp->ni_cnd);
} else {
VOP_ABORTOP(ndp->ni_dvp, &ndp->ni_cnd);
if (ndp->ni_dvp == ndp->ni_vp)
vrele(ndp->ni_dvp);
else
vput(ndp->ni_dvp);
ndp->ni_dvp = NULL;
vp = ndp->ni_vp;
if (fmode & O_EXCL) {
error = EEXIST;
Regards,
- HÃ¥vard