Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be passed the namei flags and cache_lookup also needs for the time being to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit. The glop should be able to go away eventually but requires structural cleanup elsewhere first. This change requires a kernel bump.
This commit is contained in:
parent
17158b916c
commit
35ed690545
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: adlookup.c,v 1.17 2012/11/05 17:24:09 dholland Exp $ */
|
||||
/* $NetBSD: adlookup.c,v 1.18 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adlookup.c,v 1.17 2012/11/05 17:24:09 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adlookup.c,v 1.18 2012/11/05 17:27:37 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -110,7 +110,8 @@ adosfs_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -212,7 +213,8 @@ adosfs_lookup(void *v)
|
|||
return(EJUSTRETURN);
|
||||
}
|
||||
if (nameiop != CREATE)
|
||||
cache_enter(vdp, NULL, cnp);
|
||||
cache_enter(vdp, NULL, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
#ifdef ADOSFS_DIAGNOSTIC
|
||||
printf("ENOENT)");
|
||||
#endif
|
||||
|
@ -242,7 +244,8 @@ found:
|
|||
vref(vdp);
|
||||
found_lockdone:
|
||||
if (nocache == 0)
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
#ifdef ADOSFS_DIAGNOSTIC
|
||||
printf("0)\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_lookup.c,v 1.21 2012/11/05 17:24:09 dholland Exp $ */
|
||||
/* $NetBSD: cd9660_lookup.c,v 1.22 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.21 2012/11/05 17:24:09 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.22 2012/11/05 17:27:37 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -151,7 +151,8 @@ cd9660_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -337,7 +338,7 @@ notfound:
|
|||
/*
|
||||
* Insert name into cache (as non-existent) if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
return (nameiop == CREATE || nameiop == RENAME) ? EROFS : ENOENT;
|
||||
|
||||
found:
|
||||
|
@ -400,7 +401,7 @@ found:
|
|||
/*
|
||||
* Insert name into cache if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: efs_vnops.c,v 1.27 2012/11/05 17:24:09 dholland Exp $ */
|
||||
/* $NetBSD: efs_vnops.c,v 1.28 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.27 2012/11/05 17:24:09 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.28 2012/11/05 17:27:37 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -73,7 +73,8 @@ efs_lookup(void *v)
|
|||
if (err)
|
||||
return (err);
|
||||
|
||||
if (cache_lookup(ap->a_dvp, cnp, NULL, ap->a_vpp)) {
|
||||
if (cache_lookup(ap->a_dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, ap->a_vpp)) {
|
||||
return *ap->a_vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -103,7 +104,8 @@ efs_lookup(void *v)
|
|||
EFS_VTOI(ap->a_dvp), ap->a_cnp, &ino);
|
||||
if (err) {
|
||||
if (err == ENOENT && nameiop != CREATE)
|
||||
cache_enter(ap->a_dvp, NULL, cnp);
|
||||
cache_enter(ap->a_dvp, NULL, cnp->cn_nameptr,
|
||||
cnp->cn_namelen, cnp->cn_flags);
|
||||
if (err == ENOENT && (nameiop == CREATE ||
|
||||
nameiop == RENAME)) {
|
||||
err = VOP_ACCESS(ap->a_dvp, VWRITE,
|
||||
|
@ -120,7 +122,8 @@ efs_lookup(void *v)
|
|||
*ap->a_vpp = vp;
|
||||
}
|
||||
|
||||
cache_enter(ap->a_dvp, *ap->a_vpp, cnp);
|
||||
cache_enter(ap->a_dvp, *ap->a_vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecore_lookup.c,v 1.15 2012/11/05 17:24:09 dholland Exp $ */
|
||||
/* $NetBSD: filecore_lookup.c,v 1.16 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993, 1994 The Regents of the University of California.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_lookup.c,v 1.15 2012/11/05 17:24:09 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_lookup.c,v 1.16 2012/11/05 17:27:37 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -169,7 +169,8 @@ filecore_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -247,7 +248,8 @@ notfound:
|
|||
/*
|
||||
* Insert name into cache (as non-existent) if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
return (nameiop == CREATE || nameiop == RENAME) ? EROFS : ENOENT;
|
||||
|
||||
found:
|
||||
|
@ -315,6 +317,7 @@ found:
|
|||
/*
|
||||
* Insert name into cache if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_lookup.c,v 1.25 2012/11/05 17:24:10 dholland Exp $ */
|
||||
/* $NetBSD: msdosfs_lookup.c,v 1.26 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.25 2012/11/05 17:24:10 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.26 2012/11/05 17:27:37 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -146,7 +146,8 @@ msdosfs_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT: 0;
|
||||
}
|
||||
|
||||
|
@ -401,7 +402,8 @@ notfound:
|
|||
* for 'FOO'.
|
||||
*/
|
||||
if (nameiop != CREATE)
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
#endif
|
||||
|
||||
return (ENOENT);
|
||||
|
@ -554,7 +556,7 @@ foundroot:
|
|||
/*
|
||||
* Insert name into cache if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nilfs_vnops.c,v 1.19 2012/11/05 17:24:10 dholland Exp $ */
|
||||
/* $NetBSD: nilfs_vnops.c,v 1.20 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2009 Reinoud Zandijk
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.19 2012/11/05 17:24:10 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.20 2012/11/05 17:27:37 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
|
@ -653,7 +653,8 @@ nilfs_lookup(void *v)
|
|||
DPRINTF(LOOKUP, ("\tlooking up cnp->cn_nameptr '%s'\n",
|
||||
cnp->cn_nameptr));
|
||||
/* look in the namecache */
|
||||
if (cache_lookup(dvp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -761,7 +762,8 @@ out:
|
|||
* might be seen as negative caching.
|
||||
*/
|
||||
if (nameiop != CREATE)
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
DPRINTFIF(LOOKUP, error, ("nilfs_lookup returing error %d\n", error));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ntfs_vnops.c,v 1.53 2012/11/05 17:24:10 dholland Exp $ */
|
||||
/* $NetBSD: ntfs_vnops.c,v 1.54 2012/11/05 17:27:38 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.53 2012/11/05 17:24:10 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.54 2012/11/05 17:27:38 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -682,7 +682,8 @@ ntfs_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(ap->a_dvp, cnp, NULL, ap->a_vpp)) {
|
||||
if (cache_lookup(ap->a_dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, ap->a_vpp)) {
|
||||
return *ap->a_vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -726,7 +727,8 @@ ntfs_lookup(void *v)
|
|||
(unsigned long long)VTONT(*ap->a_vpp)->i_number));
|
||||
}
|
||||
|
||||
cache_enter(dvp, *ap->a_vpp, cnp);
|
||||
cache_enter(dvp, *ap->a_vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_msgif.c,v 1.92 2012/07/27 07:38:44 manu Exp $ */
|
||||
/* $NetBSD: puffs_msgif.c,v 1.93 2012/11/05 17:27:38 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.92 2012/07/27 07:38:44 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.93 2012/11/05 17:27:38 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -915,7 +915,7 @@ puffsop_flush(struct puffs_mount *pmp, struct puffs_flush *pf)
|
|||
rv = EINVAL;
|
||||
break;
|
||||
}
|
||||
cache_purge1(vp, NULL, PURGE_CHILDREN);
|
||||
cache_purge1(vp, NULL, 0, PURGE_CHILDREN);
|
||||
break;
|
||||
|
||||
case PUFFS_INVAL_PAGECACHE_NODE_RANGE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_node.c,v 1.27 2012/07/23 19:06:10 manu Exp $ */
|
||||
/* $NetBSD: puffs_node.c,v 1.28 2012/11/05 17:27:38 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.27 2012/07/23 19:06:10 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.28 2012/11/05 17:27:38 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/hash.h>
|
||||
|
@ -247,7 +247,8 @@ puffs_newnode(struct mount *mp, struct vnode *dvp, struct vnode **vpp,
|
|||
*vpp = vp;
|
||||
|
||||
if (PUFFS_USE_NAMECACHE(pmp))
|
||||
cache_enter(dvp, vp, cnp);
|
||||
cache_enter(dvp, vp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_vnops.c,v 1.175 2012/11/05 17:24:10 dholland Exp $ */
|
||||
/* $NetBSD: puffs_vnops.c,v 1.176 2012/11/05 17:27:38 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.175 2012/11/05 17:24:10 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.176 2012/11/05 17:27:38 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -528,7 +528,9 @@ puffs_vnop_lookup(void *v)
|
|||
if (!isdot && PUFFS_USE_NAMECACHE(pmp)) {
|
||||
int found, iswhiteout;
|
||||
|
||||
found = cache_lookup(dvp, cnp, &iswhiteout, ap->a_vpp);
|
||||
found = cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags,
|
||||
&iswhiteout, ap->a_vpp);
|
||||
if (iswhiteout) {
|
||||
cnp->cn_flags |= ISWHITEOUT;
|
||||
}
|
||||
|
@ -620,7 +622,8 @@ puffs_vnop_lookup(void *v)
|
|||
} else {
|
||||
if (PUFFS_USE_NAMECACHE(pmp) &&
|
||||
!PUFFS_USE_FS_TTL(pmp))
|
||||
cache_enter(dvp, NULL, cnp);
|
||||
cache_enter(dvp, NULL, cnp->cn_nameptr,
|
||||
cnp->cn_namelen, cnp->cn_flags);
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
|
@ -696,7 +699,8 @@ puffs_vnop_lookup(void *v)
|
|||
*ap->a_vpp = vp;
|
||||
|
||||
if (PUFFS_USE_NAMECACHE(pmp))
|
||||
cache_enter(dvp, vp, cnp);
|
||||
cache_enter(dvp, vp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
/* XXX */
|
||||
if ((lookup_msg->pvnr_cn.pkcn_flags & REQUIREDIR) == 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: smbfs_vnops.c,v 1.81 2012/11/05 17:24:10 dholland Exp $ */
|
||||
/* $NetBSD: smbfs_vnops.c,v 1.82 2012/11/05 17:27:38 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -64,7 +64,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.81 2012/11/05 17:24:10 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.82 2012/11/05 17:27:38 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -596,7 +596,8 @@ smbfs_create(void *v)
|
|||
if (error)
|
||||
goto out;
|
||||
|
||||
cache_enter(dvp, *ap->a_vpp, cnp);
|
||||
cache_enter(dvp, *ap->a_vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
out:
|
||||
VN_KNOTE(dvp, NOTE_WRITE);
|
||||
|
@ -1202,7 +1203,9 @@ smbfs_lookup(void *v)
|
|||
* the time the cache entry has been created. If it has,
|
||||
* the cache entry has to be ignored.
|
||||
*/
|
||||
if (cache_lookup(dvp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags,
|
||||
NULL, vpp)) {
|
||||
struct vattr vattr;
|
||||
struct vnode *newvp;
|
||||
|
||||
|
@ -1291,7 +1294,8 @@ smbfs_lookup(void *v)
|
|||
* Insert name into cache (as non-existent) if appropriate.
|
||||
*/
|
||||
if (nameiop != CREATE)
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
return (ENOENT);
|
||||
}
|
||||
|
@ -1346,11 +1350,13 @@ smbfs_lookup(void *v)
|
|||
KASSERT(error == 0);
|
||||
if (cnp->cn_nameiop != DELETE || !islastcn) {
|
||||
VTOSMB(*vpp)->n_ctime = VTOSMB(*vpp)->n_mtime.tv_sec;
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
#ifdef notdef
|
||||
} else if (error == ENOENT && cnp->cn_nameiop != CREATE) {
|
||||
VTOSMB(*vpp)->n_nctime = VTOSMB(*vpp)->n_mtime.tv_sec;
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tmpfs_vnops.c,v 1.99 2012/11/05 17:24:11 dholland Exp $ */
|
||||
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.99 2012/11/05 17:24:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/dirent.h>
|
||||
|
@ -161,7 +161,9 @@ tmpfs_lookup(void *v)
|
|||
* Avoid doing a linear scan of the directory if the requested
|
||||
* directory/name couple is already in the cache.
|
||||
*/
|
||||
cachefound = cache_lookup(dvp, cnp, &iswhiteout, vpp);
|
||||
cachefound = cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags,
|
||||
&iswhiteout, vpp);
|
||||
if (iswhiteout) {
|
||||
cnp->cn_flags |= ISWHITEOUT;
|
||||
}
|
||||
|
@ -286,7 +288,8 @@ done:
|
|||
* not improve the performance).
|
||||
*/
|
||||
if (cnp->cn_nameiop != CREATE) {
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
}
|
||||
out:
|
||||
KASSERT((*vpp && VOP_ISLOCKED(*vpp)) || error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: udf_vnops.c,v 1.73 2012/11/05 17:24:11 dholland Exp $ */
|
||||
/* $NetBSD: udf_vnops.c,v 1.74 2012/11/05 17:27:39 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2008 Reinoud Zandijk
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.73 2012/11/05 17:24:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.74 2012/11/05 17:27:39 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
|
@ -688,7 +688,8 @@ udf_lookup(void *v)
|
|||
DPRINTF(LOOKUP, ("\tlooking up cnp->cn_nameptr '%s'\n",
|
||||
cnp->cn_nameptr));
|
||||
/* look in the namecache */
|
||||
if (cache_lookup(dvp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -796,7 +797,8 @@ out:
|
|||
* might be seen as negative caching.
|
||||
*/
|
||||
if (nameiop != CREATE)
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
DPRINTFIF(LOOKUP, error, ("udf_lookup returing error %d\n", error));
|
||||
|
||||
|
|
|
@ -143,7 +143,8 @@ unionfs_lookup(void *v)
|
|||
vn_lock(dunp->un_dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
} else if (error == ENOENT && nameiop != CREATE)
|
||||
cache_enter(dvp, NULLVP, cnp);
|
||||
cache_enter(dvp, NULLVP, cnp->cn_nameptr,
|
||||
cnp->cn_namelen, cnp->cn_flags);
|
||||
|
||||
UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error);
|
||||
|
||||
|
@ -268,7 +269,8 @@ unionfs_lookup(void *v)
|
|||
|
||||
*(ap->a_vpp) = vp;
|
||||
|
||||
cache_enter(dvp, vp, cnp);
|
||||
cache_enter(dvp, vp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
/* XXXAD lock status on error */
|
||||
unionfs_lookup_out:
|
||||
|
@ -278,7 +280,8 @@ unionfs_lookup_out:
|
|||
vrele(lvp);
|
||||
|
||||
if (error == ENOENT && nameiop != CREATE)
|
||||
cache_enter(dvp, NULLVP, cnp);
|
||||
cache_enter(dvp, NULLVP, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
|
||||
UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_cache.c,v 1.90 2012/11/05 17:24:11 dholland Exp $ */
|
||||
/* $NetBSD: vfs_cache.c,v 1.91 2012/11/05 17:27:39 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.90 2012/11/05 17:24:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.91 2012/11/05 17:27:39 dholland Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_revcache.h"
|
||||
|
@ -161,7 +161,7 @@ static struct evcnt cache_ev_forced;
|
|||
|
||||
static void cache_invalidate(struct namecache *);
|
||||
static struct namecache *cache_lookup_entry(
|
||||
const struct vnode *, const struct componentname *);
|
||||
const struct vnode *, const char *, size_t);
|
||||
static void cache_thread(void *);
|
||||
static void cache_invalidate(struct namecache *);
|
||||
static void cache_disassociate(struct namecache *);
|
||||
|
@ -176,12 +176,12 @@ static void cache_dtor(void *, void *);
|
|||
* for the time being slightly inconvenient.)
|
||||
*/
|
||||
static nchash_t
|
||||
cache_hash(const struct componentname *cnp)
|
||||
cache_hash(const char *name, size_t namelen)
|
||||
{
|
||||
const char *endptr;
|
||||
|
||||
endptr = cnp->cn_nameptr + cnp->cn_namelen;
|
||||
return namei_hash(cnp->cn_nameptr, &endptr);
|
||||
endptr = name + namelen;
|
||||
return namei_hash(name, &endptr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -282,20 +282,20 @@ cache_unlock_cpus(void)
|
|||
* at least one of the per-CPU locks must be held.
|
||||
*/
|
||||
static struct namecache *
|
||||
cache_lookup_entry(const struct vnode *dvp, const struct componentname *cnp)
|
||||
cache_lookup_entry(const struct vnode *dvp, const char *name, size_t namelen)
|
||||
{
|
||||
struct nchashhead *ncpp;
|
||||
struct namecache *ncp;
|
||||
nchash_t hash;
|
||||
|
||||
KASSERT(dvp != NULL);
|
||||
hash = cache_hash(cnp);
|
||||
hash = cache_hash(name, namelen);
|
||||
ncpp = &nchashtbl[NCHASH2(hash, dvp)];
|
||||
|
||||
LIST_FOREACH(ncp, ncpp, nc_hash) {
|
||||
if (ncp->nc_dvp != dvp ||
|
||||
ncp->nc_nlen != cnp->cn_namelen ||
|
||||
memcmp(ncp->nc_name, cnp->cn_nameptr, (u_int)ncp->nc_nlen))
|
||||
ncp->nc_nlen != namelen ||
|
||||
memcmp(ncp->nc_name, name, (u_int)ncp->nc_nlen))
|
||||
continue;
|
||||
mutex_enter(&ncp->nc_lock);
|
||||
if (__predict_true(ncp->nc_dvp == dvp)) {
|
||||
|
@ -360,7 +360,8 @@ cache_lookup_entry(const struct vnode *dvp, const struct componentname *cnp)
|
|||
* depending on what error occurred.)
|
||||
*/
|
||||
int
|
||||
cache_lookup(struct vnode *dvp, const struct componentname *cnp,
|
||||
cache_lookup(struct vnode *dvp, const char *name, size_t namelen,
|
||||
uint32_t nameiop, uint32_t cnflags,
|
||||
int *iswht_ret, struct vnode **vn_ret)
|
||||
{
|
||||
struct namecache *ncp;
|
||||
|
@ -380,20 +381,20 @@ cache_lookup(struct vnode *dvp, const struct componentname *cnp,
|
|||
|
||||
cpup = curcpu()->ci_data.cpu_nch;
|
||||
mutex_enter(&cpup->cpu_lock);
|
||||
if (__predict_false(cnp->cn_namelen > NCHNAMLEN)) {
|
||||
if (__predict_false(namelen > NCHNAMLEN)) {
|
||||
COUNT(cpup->cpu_stats, ncs_long);
|
||||
mutex_exit(&cpup->cpu_lock);
|
||||
/* found nothing */
|
||||
return 0;
|
||||
}
|
||||
ncp = cache_lookup_entry(dvp, cnp);
|
||||
ncp = cache_lookup_entry(dvp, name, namelen);
|
||||
if (__predict_false(ncp == NULL)) {
|
||||
COUNT(cpup->cpu_stats, ncs_miss);
|
||||
mutex_exit(&cpup->cpu_lock);
|
||||
/* found nothing */
|
||||
return 0;
|
||||
}
|
||||
if ((cnp->cn_flags & MAKEENTRY) == 0) {
|
||||
if ((cnflags & MAKEENTRY) == 0) {
|
||||
COUNT(cpup->cpu_stats, ncs_badhits);
|
||||
/*
|
||||
* Last component and we are renaming or deleting,
|
||||
|
@ -412,14 +413,13 @@ cache_lookup(struct vnode *dvp, const struct componentname *cnp,
|
|||
* Restore the ISWHITEOUT flag saved earlier.
|
||||
*/
|
||||
KASSERT((ncp->nc_flags & ~ISWHITEOUT) == 0);
|
||||
/*cnp->cn_flags |= ncp->nc_flags;*/
|
||||
*iswht_ret = (ncp->nc_flags & ISWHITEOUT) != 0;
|
||||
} else {
|
||||
KASSERT(ncp->nc_flags == 0);
|
||||
}
|
||||
|
||||
if (__predict_true(cnp->cn_nameiop != CREATE ||
|
||||
(cnp->cn_flags & ISLASTCN) == 0)) {
|
||||
if (__predict_true(nameiop != CREATE ||
|
||||
(cnflags & ISLASTCN) == 0)) {
|
||||
COUNT(cpup->cpu_stats, ncs_neghits);
|
||||
mutex_exit(&ncp->nc_lock);
|
||||
mutex_exit(&cpup->cpu_lock);
|
||||
|
@ -472,7 +472,7 @@ cache_lookup(struct vnode *dvp, const struct componentname *cnp,
|
|||
|
||||
if (vp == dvp) { /* lookup on "." */
|
||||
error = 0;
|
||||
} else if (cnp->cn_flags & ISDOTDOT) {
|
||||
} else if (cnflags & ISDOTDOT) {
|
||||
VOP_UNLOCK(dvp);
|
||||
error = vn_lock(vp, LK_EXCLUSIVE);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
|
@ -501,7 +501,8 @@ cache_lookup(struct vnode *dvp, const struct componentname *cnp,
|
|||
}
|
||||
|
||||
int
|
||||
cache_lookup_raw(struct vnode *dvp, const struct componentname *cnp,
|
||||
cache_lookup_raw(struct vnode *dvp, const char *name, size_t namelen,
|
||||
uint32_t cnflags,
|
||||
int *iswht_ret, struct vnode **vn_ret)
|
||||
{
|
||||
struct namecache *ncp;
|
||||
|
@ -522,13 +523,13 @@ cache_lookup_raw(struct vnode *dvp, const struct componentname *cnp,
|
|||
|
||||
cpup = curcpu()->ci_data.cpu_nch;
|
||||
mutex_enter(&cpup->cpu_lock);
|
||||
if (__predict_false(cnp->cn_namelen > NCHNAMLEN)) {
|
||||
if (__predict_false(namelen > NCHNAMLEN)) {
|
||||
COUNT(cpup->cpu_stats, ncs_long);
|
||||
mutex_exit(&cpup->cpu_lock);
|
||||
/* found nothing */
|
||||
return 0;
|
||||
}
|
||||
ncp = cache_lookup_entry(dvp, cnp);
|
||||
ncp = cache_lookup_entry(dvp, name, namelen);
|
||||
if (__predict_false(ncp == NULL)) {
|
||||
COUNT(cpup->cpu_stats, ncs_miss);
|
||||
mutex_exit(&cpup->cpu_lock);
|
||||
|
@ -670,7 +671,8 @@ cache_revlookup(struct vnode *vp, struct vnode **dvpp, char **bpp, char *bufp)
|
|||
* Add an entry to the cache
|
||||
*/
|
||||
void
|
||||
cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
||||
cache_enter(struct vnode *dvp, struct vnode *vp,
|
||||
const char *name, size_t namelen, uint32_t cnflags)
|
||||
{
|
||||
struct namecache *ncp;
|
||||
struct namecache *oncp;
|
||||
|
@ -679,8 +681,8 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
|||
nchash_t hash;
|
||||
|
||||
/* First, check whether we can/should add a cache entry. */
|
||||
if ((cnp->cn_flags & MAKEENTRY) == 0 ||
|
||||
__predict_false(cnp->cn_namelen > NCHNAMLEN || !doingcache)) {
|
||||
if ((cnflags & MAKEENTRY) == 0 ||
|
||||
__predict_false(namelen > NCHNAMLEN || !doingcache)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -699,7 +701,7 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
|||
* Concurrent lookups in the same directory may race for a
|
||||
* cache entry. if there's a duplicated entry, free it.
|
||||
*/
|
||||
oncp = cache_lookup_entry(dvp, cnp);
|
||||
oncp = cache_lookup_entry(dvp, name, namelen);
|
||||
if (oncp) {
|
||||
cache_invalidate(oncp);
|
||||
mutex_exit(&oncp->nc_lock);
|
||||
|
@ -716,7 +718,7 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
|||
* For negative hits, save the ISWHITEOUT flag so we can
|
||||
* restore it later when the cache entry is used again.
|
||||
*/
|
||||
ncp->nc_flags = cnp->cn_flags & ISWHITEOUT;
|
||||
ncp->nc_flags = cnflags & ISWHITEOUT;
|
||||
}
|
||||
|
||||
/* Fill in cache info. */
|
||||
|
@ -728,11 +730,11 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
|||
ncp->nc_vlist.le_prev = NULL;
|
||||
ncp->nc_vlist.le_next = NULL;
|
||||
}
|
||||
KASSERT(cnp->cn_namelen <= NCHNAMLEN);
|
||||
ncp->nc_nlen = cnp->cn_namelen;
|
||||
memcpy(ncp->nc_name, cnp->cn_nameptr, (unsigned)ncp->nc_nlen);
|
||||
KASSERT(namelen <= NCHNAMLEN);
|
||||
ncp->nc_nlen = namelen;
|
||||
memcpy(ncp->nc_name, name, (unsigned)ncp->nc_nlen);
|
||||
TAILQ_INSERT_TAIL(&nclruhead, ncp, nc_lru);
|
||||
hash = cache_hash(cnp);
|
||||
hash = cache_hash(name, namelen);
|
||||
ncpp = &nchashtbl[NCHASH2(hash, dvp)];
|
||||
|
||||
/*
|
||||
|
@ -898,7 +900,7 @@ nchreinit(void)
|
|||
* hide entries that would now be invalid
|
||||
*/
|
||||
void
|
||||
cache_purge1(struct vnode *vp, const struct componentname *cnp, int flags)
|
||||
cache_purge1(struct vnode *vp, const char *name, size_t namelen, int flags)
|
||||
{
|
||||
struct namecache *ncp, *ncnext;
|
||||
|
||||
|
@ -923,8 +925,8 @@ cache_purge1(struct vnode *vp, const struct componentname *cnp, int flags)
|
|||
cache_disassociate(ncp);
|
||||
}
|
||||
}
|
||||
if (cnp != NULL) {
|
||||
ncp = cache_lookup_entry(vp, cnp);
|
||||
if (name != NULL) {
|
||||
ncp = cache_lookup_entry(vp, name, namelen);
|
||||
if (ncp) {
|
||||
cache_invalidate(ncp);
|
||||
mutex_exit(&ncp->nc_lock);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_vnops.c,v 1.296 2012/11/05 17:24:11 dholland Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.297 2012/11/05 17:27:39 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.296 2012/11/05 17:24:11 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.297 2012/11/05 17:27:39 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_nfs.h"
|
||||
|
@ -279,7 +279,7 @@ nfs_cache_enter(struct vnode *dvp, struct vnode *vp,
|
|||
if (!timespecisset(&dnp->n_nctime))
|
||||
dnp->n_nctime = dnp->n_vattr->va_mtime;
|
||||
|
||||
cache_enter(dvp, vp, cnp);
|
||||
cache_enter(dvp, vp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -818,7 +818,8 @@ nfs_lookup(void *v)
|
|||
* the time the cache entry has been created. If it has,
|
||||
* the cache entry has to be ignored.
|
||||
*/
|
||||
cachefound = cache_lookup_raw(dvp, cnp, NULL, vpp);
|
||||
cachefound = cache_lookup_raw(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags, NULL, vpp);
|
||||
KASSERT(dvp != *vpp);
|
||||
KASSERT((cnp->cn_flags & ISWHITEOUT) == 0);
|
||||
if (cachefound) {
|
||||
|
@ -839,7 +840,7 @@ nfs_lookup(void *v)
|
|||
vrele(*vpp);
|
||||
*vpp = NULLVP;
|
||||
}
|
||||
cache_purge1(dvp, NULL, PURGE_CHILDREN);
|
||||
cache_purge1(dvp, NULL, 0, PURGE_CHILDREN);
|
||||
timespecclear(&np->n_nctime);
|
||||
goto dorpc;
|
||||
}
|
||||
|
@ -873,7 +874,7 @@ nfs_lookup(void *v)
|
|||
KASSERT(newvp->v_type != VNON);
|
||||
return (0);
|
||||
}
|
||||
cache_purge1(newvp, NULL, PURGE_PARENTS);
|
||||
cache_purge1(newvp, NULL, 0, PURGE_PARENTS);
|
||||
vput(newvp);
|
||||
*vpp = NULLVP;
|
||||
}
|
||||
|
@ -1577,7 +1578,7 @@ nfs_mknod(void *v)
|
|||
error = nfs_mknodrpc(dvp, ap->a_vpp, cnp, ap->a_vap);
|
||||
VN_KNOTE(dvp, NOTE_WRITE);
|
||||
if (error == 0 || error == EEXIST)
|
||||
cache_purge1(dvp, cnp, 0);
|
||||
cache_purge1(dvp, cnp->cn_nameptr, cnp->cn_namelen, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -1704,13 +1705,13 @@ again:
|
|||
if (cnp->cn_flags & MAKEENTRY)
|
||||
nfs_cache_enter(dvp, newvp, cnp);
|
||||
else
|
||||
cache_purge1(dvp, cnp, 0);
|
||||
cache_purge1(dvp, cnp->cn_nameptr, cnp->cn_namelen, 0);
|
||||
*ap->a_vpp = newvp;
|
||||
} else {
|
||||
if (newvp)
|
||||
vput(newvp);
|
||||
if (error == EEXIST)
|
||||
cache_purge1(dvp, cnp, 0);
|
||||
cache_purge1(dvp, cnp->cn_nameptr, cnp->cn_namelen, 0);
|
||||
}
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
|
@ -1900,11 +1901,13 @@ nfs_rename(void *v)
|
|||
if (fvp->v_type == VDIR)
|
||||
cache_purge(fvp);
|
||||
else
|
||||
cache_purge1(fdvp, fcnp, 0);
|
||||
cache_purge1(fdvp, fcnp->cn_nameptr, fcnp->cn_namelen,
|
||||
0);
|
||||
if (tvp != NULL && tvp->v_type == VDIR)
|
||||
cache_purge(tvp);
|
||||
else
|
||||
cache_purge1(tdvp, tcnp, 0);
|
||||
cache_purge1(tdvp, tcnp->cn_nameptr, tcnp->cn_namelen,
|
||||
0);
|
||||
}
|
||||
out:
|
||||
if (tdvp == tvp)
|
||||
|
@ -2065,7 +2068,7 @@ nfs_link(void *v)
|
|||
cnp->cn_cred, curlwp);
|
||||
|
||||
if (error == 0) {
|
||||
cache_purge1(dvp, cnp, 0);
|
||||
cache_purge1(dvp, cnp->cn_nameptr, cnp->cn_namelen, 0);
|
||||
}
|
||||
VOP_UNLOCK(vp);
|
||||
VN_KNOTE(vp, NOTE_LINK);
|
||||
|
@ -2141,7 +2144,7 @@ nfs_symlink(void *v)
|
|||
if (rexmit && error == EEXIST)
|
||||
error = 0;
|
||||
if (error == 0 || error == EEXIST)
|
||||
cache_purge1(dvp, cnp, 0);
|
||||
cache_purge1(dvp, cnp->cn_nameptr, cnp->cn_namelen, 0);
|
||||
if (error == 0 && newvp == NULL) {
|
||||
struct nfsnode *np = NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: namei.src,v 1.28 2012/11/05 17:24:09 dholland Exp $ */
|
||||
/* $NetBSD: namei.src,v 1.29 2012/11/05 17:27:37 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1991, 1993
|
||||
|
@ -259,16 +259,17 @@ uint32_t namei_hash(const char *, const char **);
|
|||
int lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow);
|
||||
int lookup_for_nfsd_index(struct nameidata *, struct vnode *);
|
||||
int relookup(struct vnode *, struct vnode **, struct componentname *, int);
|
||||
void cache_purge1(struct vnode *, const struct componentname *, int);
|
||||
void cache_purge1(struct vnode *, const char *, size_t, int);
|
||||
#define PURGE_PARENTS 1
|
||||
#define PURGE_CHILDREN 2
|
||||
#define cache_purge(vp) cache_purge1((vp), NULL, PURGE_PARENTS|PURGE_CHILDREN)
|
||||
int cache_lookup(struct vnode *, const struct componentname *,
|
||||
#define cache_purge(vp) cache_purge1((vp),NULL,0,PURGE_PARENTS|PURGE_CHILDREN)
|
||||
int cache_lookup(struct vnode *, const char *, size_t, uint32_t, uint32_t,
|
||||
int *, struct vnode **);
|
||||
int cache_lookup_raw(struct vnode *, const struct componentname *,
|
||||
int cache_lookup_raw(struct vnode *, const char *, size_t, uint32_t,
|
||||
int *, struct vnode **);
|
||||
int cache_revlookup(struct vnode *, struct vnode **, char **, char *);
|
||||
void cache_enter(struct vnode *, struct vnode *, struct componentname *);
|
||||
void cache_enter(struct vnode *, struct vnode *,
|
||||
const char *, size_t, uint32_t);
|
||||
void nchinit(void);
|
||||
void nchreinit(void);
|
||||
void cache_cpu_init(struct cpu_info *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chfs_vnops.c,v 1.12 2012/11/05 17:24:12 dholland Exp $ */
|
||||
/* $NetBSD: chfs_vnops.c,v 1.13 2012/11/05 17:27:40 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
|
@ -86,7 +86,8 @@ chfs_lookup(void *v)
|
|||
|
||||
/* Avoid doing a linear scan of the directory if the requested
|
||||
* directory/name couple is already in the cache. */
|
||||
if (cache_lookup(dvp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
error = *vpp == NULLVP ? ENOENT : 0;
|
||||
goto out;
|
||||
}
|
||||
|
@ -155,7 +156,8 @@ chfs_lookup(void *v)
|
|||
* request was for creation, as it does not improve timings on
|
||||
* emprical tests. */
|
||||
if (cnp->cn_nameiop != CREATE && (cnp->cn_flags & ISDOTDOT) == 0) {
|
||||
cache_enter(dvp, *vpp, cnp);
|
||||
cache_enter(dvp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_lookup.c,v 1.71 2012/11/05 17:24:12 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.72 2012/11/05 17:27:40 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Modified for NetBSD 1.2E
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.71 2012/11/05 17:24:12 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.72 2012/11/05 17:27:40 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -325,7 +325,8 @@ ext2fs_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, NULL, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
|
||||
return *vpp == NULLVP ? ENOENT : 0;
|
||||
}
|
||||
|
||||
|
@ -540,7 +541,8 @@ searchloop:
|
|||
* Insert name into cache (as non-existent) if appropriate.
|
||||
*/
|
||||
if (nameiop != CREATE) {
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
}
|
||||
return ENOENT;
|
||||
|
||||
|
@ -700,7 +702,7 @@ found:
|
|||
/*
|
||||
* Insert name into cache if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_lookup.c,v 1.119 2012/11/05 17:24:12 dholland Exp $ */
|
||||
/* $NetBSD: ufs_lookup.c,v 1.120 2012/11/05 17:27:40 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.119 2012/11/05 17:24:12 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.120 2012/11/05 17:27:40 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ffs.h"
|
||||
|
@ -187,7 +187,8 @@ ufs_lookup(void *v)
|
|||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if (cache_lookup(vdp, cnp, &iswhiteout, vpp)) {
|
||||
if (cache_lookup(vdp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_nameiop, cnp->cn_flags, &iswhiteout, vpp)) {
|
||||
if (iswhiteout) {
|
||||
cnp->cn_flags |= ISWHITEOUT;
|
||||
}
|
||||
|
@ -514,7 +515,8 @@ notfound:
|
|||
* Insert name into cache (as non-existent) if appropriate.
|
||||
*/
|
||||
if (nameiop != CREATE) {
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
|
||||
cnp->cn_flags);
|
||||
}
|
||||
error = ENOENT;
|
||||
goto out;
|
||||
|
@ -678,7 +680,7 @@ found:
|
|||
/*
|
||||
* Insert name into cache if appropriate.
|
||||
*/
|
||||
cache_enter(vdp, *vpp, cnp);
|
||||
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags);
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
|
|
Loading…
Reference in New Issue