From: Matthew Dillon Date: Thu, 9 Oct 2003 22:27:27 +0000 (+0000) Subject: namecache work stage 3a: Adjust the VFS APIs to include a namecache pointer X-Git-Tag: v2.0.1~12864 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/bc0c094e30504ceeedcb8e3d5c882a9b35ba604c namecache work stage 3a: Adjust the VFS APIs to include a namecache pointer where necessary. For the moment we pass NULL for these parameters (the old 'dvp' vnode pointer's cannot be ripped out quite yet). --- diff --git a/sys/emulation/linux/linux_getcwd.c b/sys/emulation/linux/linux_getcwd.c index ff1e2dd267..081c37937a 100644 --- a/sys/emulation/linux/linux_getcwd.c +++ b/sys/emulation/linux/linux_getcwd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.2.2.3 2001/11/05 19:08:22 marcel Exp $ */ -/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.12 2003/09/23 05:03:50 dillon Exp $ */ +/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.13 2003/10/09 22:27:08 dillon Exp $ */ /* $OpenBSD: linux_getcwd.c,v 1.2 2001/05/16 12:50:21 ho Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ @@ -162,7 +162,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td) * At this point, lvp is locked and will be unlocked by the lookup. * On successful return, *uvpp will be locked */ - error = VOP_LOOKUP(lvp, uvpp, &cn); + error = VOP_LOOKUP(lvp, NCPNULL, uvpp, NCPPNULL, &cn); if (error) { vput(lvp); *lvpp = NULL; diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 3c731844cc..7301b07394 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -32,7 +32,7 @@ * * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.54.2.10 2003/03/04 17:28:09 nectar Exp $ - * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.9 2003/09/29 18:52:06 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.10 2003/10/09 22:27:19 dillon Exp $ */ #include @@ -618,7 +618,7 @@ unp_bind(struct unpcb *unp, struct sockaddr *nam, struct thread *td) vattr.va_type = VSOCK; vattr.va_mode = (ACCESSPERMS & ~p->p_fd->fd_cmask); VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); + error = VOP_CREATE(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, &vattr); NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); if (error) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3d5bf7bcff..6894d38f3d 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -37,7 +37,7 @@ * * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 * $FreeBSD: src/sys/kern/vfs_cache.c,v 1.42.2.6 2001/10/05 20:07:03 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cache.c,v 1.10 2003/10/01 22:51:24 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_cache.c,v 1.11 2003/10/09 22:27:19 dillon Exp $ */ #include @@ -127,7 +127,7 @@ MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); */ static __inline struct namecache * -cache_hold(struct namecache *ncp) +_cache_hold(struct namecache *ncp) { ++ncp->nc_refs; return(ncp); @@ -135,7 +135,7 @@ cache_hold(struct namecache *ncp) static __inline void -cache_drop(struct namecache *ncp) +_cache_drop(struct namecache *ncp) { KKASSERT(ncp->nc_refs > 0); if (ncp->nc_refs == 1 && (ncp->nc_flag & NCF_HASHED) == 0) @@ -144,6 +144,18 @@ cache_drop(struct namecache *ncp) --ncp->nc_refs; } +struct namecache * +cache_hold(struct namecache *ncp) +{ + return(_cache_hold(ncp)); +} + +void +cache_drop(struct namecache *ncp) +{ + _cache_drop(ncp); +} + /* * Try to destroy a namecache entry. The entry is disassociated from its * vnode or ncneglist and reverted to an UNRESOLVED state. @@ -257,7 +269,8 @@ done: * entries. */ int -cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +cache_lookup(struct vnode *dvp, struct namecache *par, struct vnode **vpp, + struct namecache **ncpp, struct componentname *cnp) { struct namecache *ncp; u_int32_t hash; @@ -363,7 +376,7 @@ cache_mount(struct vnode *dvp, struct vnode *tvp) { struct namecache *ncp; struct namecache *par; - struct nchashhead *ncpp; + struct nchashhead *nchpp; u_int32_t hash; /* @@ -427,8 +440,8 @@ cache_mount(struct vnode *dvp, struct vnode *tvp) */ hash = fnv_32_buf("", 0, FNV1_32_INIT); hash = fnv_32_buf(&ncp->nc_dvp_id, sizeof(ncp->nc_dvp_id), hash); - ncpp = NCHHASH(hash); - LIST_INSERT_HEAD(ncpp, ncp, nc_hash); + nchpp = NCHHASH(hash); + LIST_INSERT_HEAD(nchpp, ncp, nc_hash); ncp->nc_flag |= NCF_HASHED; } @@ -437,13 +450,14 @@ cache_mount(struct vnode *dvp, struct vnode *tvp) * Add an entry to the cache. */ void -cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +cache_enter(struct vnode *dvp, struct namecache *par, struct vnode *vp, struct componentname *cnp) { struct namecache *ncp; - struct namecache *par; - struct nchashhead *ncpp; + struct nchashhead *nchpp; u_int32_t hash; + /* YYY use par */ + /* * "." and ".." are degenerate cases, they are not added to the * cache. @@ -524,8 +538,8 @@ cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) */ ncp->nc_nlen = cnp->cn_namelen; bcopy(cnp->cn_nameptr, ncp->nc_name, cnp->cn_namelen); - ncpp = NCHHASH(hash); - LIST_INSERT_HEAD(ncpp, ncp, nc_hash); + nchpp = NCHHASH(hash); + LIST_INSERT_HEAD(nchpp, ncp, nc_hash); ncp->nc_flag |= NCF_HASHED; } else if (vp && !TAILQ_EMPTY(&vp->v_namecache)) { @@ -711,14 +725,14 @@ restart: /* YYY hack, fix me */ void cache_purgevfs(struct mount *mp) { - struct nchashhead *ncpp; + struct nchashhead *nchpp; struct namecache *ncp, *nnp; /* * Scan hash tables for applicable entries. */ - for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { - ncp = LIST_FIRST(ncpp); + for (nchpp = &nchashtbl[nchash]; nchpp >= nchashtbl; nchpp--) { + ncp = LIST_FIRST(nchpp); if (ncp) cache_hold(ncp); while (ncp) { @@ -763,7 +777,9 @@ cache_leaf_test(struct vnode *vp) * * vop_lookup_args { * struct vnode a_dvp; + * struct namecache *a_ncp; * struct vnode **a_vpp; + * struct namecache **a_ncpp; * struct componentname *a_cnp; * } */ @@ -773,7 +789,9 @@ vfs_cache_lookup(struct vop_lookup_args *ap) struct vnode *dvp, *vp; int lockparent; int error; + struct namecache *par = ap->a_par; struct vnode **vpp = ap->a_vpp; + struct namecache **ncpp = ap->a_ncpp; struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; @@ -781,6 +799,8 @@ vfs_cache_lookup(struct vop_lookup_args *ap) u_long vpid; /* capability number of vnode */ *vpp = NULL; + if (ncpp) + *ncpp = NULL; dvp = ap->a_dvp; lockparent = flags & CNP_LOCKPARENT; @@ -797,10 +817,10 @@ vfs_cache_lookup(struct vop_lookup_args *ap) if (error) return (error); - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup(dvp, par, vpp, ncpp, cnp); if (!error) - return (VOP_CACHEDLOOKUP(dvp, vpp, cnp)); + return (VOP_CACHEDLOOKUP(dvp, par, vpp, ncpp, cnp)); if (error == ENOENT) return (error); @@ -845,7 +865,7 @@ vfs_cache_lookup(struct vop_lookup_args *ap) return (error); cnp->cn_flags &= ~CNP_PDIRUNLOCK; } - return (VOP_CACHEDLOOKUP(dvp, vpp, cnp)); + return (VOP_CACHEDLOOKUP(dvp, par, vpp, ncpp, cnp)); } static int disablecwd; diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 87ed7e6bea..7942abf7b6 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -37,7 +37,7 @@ * * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 * $FreeBSD: src/sys/kern/vfs_lookup.c,v 1.38.2.3 2001/08/31 19:36:49 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_lookup.c,v 1.7 2003/09/28 03:44:02 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_lookup.c,v 1.8 2003/10/09 22:27:19 dillon Exp $ */ #include "opt_ktrace.h" @@ -269,11 +269,10 @@ namei(struct nameidata *ndp) * if WANTPARENT set, return unlocked parent in ni_dvp */ int -lookup(ndp) - struct nameidata *ndp; +lookup(struct nameidata *ndp) { - char *cp; /* pointer into pathname argument */ - struct vnode *dp = 0; /* the directory we are searching */ + char *cp; /* pointer into pathname argument */ + struct vnode *dp = NULL; /* the directory we are searching */ struct vnode *tdp; /* saved dp */ struct mount *mp; /* mount table entry */ int docache; /* == 0 do not cache last component */ @@ -431,7 +430,7 @@ unionlookup: ndp->ni_vp = NULL; cnp->cn_flags &= ~CNP_PDIRUNLOCK; ASSERT_VOP_LOCKED(dp, "lookup"); - if ((error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp)) != 0) { + if ((error = VOP_LOOKUP(dp, NCPNULL, &ndp->ni_vp, NCPPNULL, cnp)) != 0) { KASSERT(ndp->ni_vp == NULL, ("leaf should be empty")); #ifdef NAMEI_DIAGNOSTIC printf("not found\n"); @@ -671,7 +670,7 @@ relookup(dvp, vpp, cnp) /* * We now have a segment name to search for, and a directory to search. */ - if ((error = VOP_LOOKUP(dp, vpp, cnp)) != 0) { + if ((error = VOP_LOOKUP(dp, NCPNULL, vpp, NCPPNULL, cnp)) != 0) { KASSERT(*vpp == NULL, ("leaf should be empty")); if (error != EJUSTRETURN) goto bad; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index fb2c19cf3b..20dde8e982 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -37,7 +37,7 @@ * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_subr.c,v 1.21 2003/09/28 03:44:02 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_subr.c,v 1.22 2003/10/09 22:27:19 dillon Exp $ */ /* @@ -3105,18 +3105,32 @@ NDFREE(ndp, flags) zfree(namei_zone, ndp->ni_cnd.cn_pnbuf); ndp->ni_cnd.cn_flags &= ~CNP_HASBUF; } + if (!(flags & NDF_NO_DNCP_RELE) && + (ndp->ni_cnd.cn_flags & CNP_WANTDNCP) && + ndp->ni_dncp) { + cache_drop(ndp->ni_dncp); + ndp->ni_dncp = NULL; + } + if (!(flags & NDF_NO_NCP_RELE) && + (ndp->ni_cnd.cn_flags & CNP_WANTNCP) && + ndp->ni_ncp) { + cache_drop(ndp->ni_ncp); + ndp->ni_ncp = NULL; + } if (!(flags & NDF_NO_DVP_UNLOCK) && (ndp->ni_cnd.cn_flags & CNP_LOCKPARENT) && - ndp->ni_dvp != ndp->ni_vp) + ndp->ni_dvp != ndp->ni_vp) { VOP_UNLOCK(ndp->ni_dvp, 0, ndp->ni_cnd.cn_td); + } if (!(flags & NDF_NO_DVP_RELE) && (ndp->ni_cnd.cn_flags & (CNP_LOCKPARENT|CNP_WANTPARENT))) { vrele(ndp->ni_dvp); ndp->ni_dvp = NULL; } if (!(flags & NDF_NO_VP_UNLOCK) && - (ndp->ni_cnd.cn_flags & CNP_LOCKLEAF) && ndp->ni_vp) + (ndp->ni_cnd.cn_flags & CNP_LOCKLEAF) && ndp->ni_vp) { VOP_UNLOCK(ndp->ni_vp, 0, ndp->ni_cnd.cn_td); + } if (!(flags & NDF_NO_VP_RELE) && ndp->ni_vp) { vrele(ndp->ni_vp); @@ -3128,3 +3142,4 @@ NDFREE(ndp, flags) ndp->ni_startdir = NULL; } } + diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c301d033f4..3559110e4e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -37,7 +37,7 @@ * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.19 2003/09/29 18:52:06 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.20 2003/10/09 22:27:19 dillon Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -1136,9 +1136,9 @@ mknod(struct mknod_args *uap) if (!error) { VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); if (whiteout) - error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, NAMEI_CREATE); + error = VOP_WHITEOUT(nd.ni_dvp, NCPNULL, &nd.ni_cnd, NAMEI_CREATE); else { - error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, + error = VOP_MKNOD(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, &vattr); if (error == 0) vput(nd.ni_vp); @@ -1192,7 +1192,7 @@ mkfifo(struct mkfifo_args *uap) vattr.va_type = VFIFO; vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask; VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); + error = VOP_MKNOD(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, &vattr); if (error == 0) vput(nd.ni_vp); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1237,7 +1237,7 @@ link(struct link_args *uap) VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE); - error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); + error = VOP_LINK(nd.ni_dvp, NCPNULL, vp, &nd.ni_cnd); } NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_dvp == nd.ni_vp) @@ -1289,7 +1289,7 @@ symlink(struct symlink_args *uap) VATTR_NULL(&vattr); vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask; VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path); + error = VOP_SYMLINK(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, &vattr, path); NDFREE(&nd, NDF_ONLY_PNBUF); if (error == 0) vput(nd.ni_vp); @@ -1334,7 +1334,7 @@ undelete(struct undelete_args *uap) } VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, NAMEI_DELETE); + error = VOP_WHITEOUT(nd.ni_dvp, NCPNULL, &nd.ni_cnd, NAMEI_DELETE); NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); ASSERT_VOP_UNLOCKED(nd.ni_dvp, "undelete"); @@ -1378,7 +1378,7 @@ unlink(struct unlink_args *uap) if (!error) { VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); + error = VOP_REMOVE(nd.ni_dvp, NCPNULL, vp, &nd.ni_cnd); } NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_dvp == vp) @@ -2361,8 +2361,8 @@ out: if (tvp) { VOP_LEASE(tvp, td, p->p_ucred, LEASE_WRITE); } - error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, - tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); + error = VOP_RENAME(fromnd.ni_dvp, NCPNULL, fromnd.ni_vp, &fromnd.ni_cnd, + tond.ni_dvp, NCPNULL, tond.ni_vp, &tond.ni_cnd); NDFREE(&fromnd, NDF_ONLY_PNBUF); NDFREE(&tond, NDF_ONLY_PNBUF); } else { @@ -2426,7 +2426,7 @@ mkdir(struct mkdir_args *uap) vattr.va_type = VDIR; vattr.va_mode = (SCARG(uap, mode) & ACCESSPERMS) &~ p->p_fd->fd_cmask; VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); - error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); + error = VOP_MKDIR(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, &vattr); NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); if (!error) @@ -2476,7 +2476,7 @@ rmdir(struct rmdir_args *uap) else { VOP_LEASE(nd.ni_dvp, td, p->p_ucred, LEASE_WRITE); VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE); - error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); + error = VOP_RMDIR(nd.ni_dvp, NCPNULL, nd.ni_vp, &nd.ni_cnd); } out: NDFREE(&nd, NDF_ONLY_PNBUF); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index e5146f15ad..248b0ea9e9 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -37,7 +37,7 @@ * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.87.2.13 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.14 2003/09/29 18:52:06 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.15 2003/10/09 22:27:19 dillon Exp $ */ #include @@ -111,7 +111,7 @@ vn_open(ndp, fmode, cmode) if (fmode & O_EXCL) vap->va_vaflags |= VA_EXCLUSIVE; VOP_LEASE(ndp->ni_dvp, td, cred, LEASE_WRITE); - error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp, + error = VOP_CREATE(ndp->ni_dvp, NCPNULL, &ndp->ni_vp, &ndp->ni_cnd, vap); if (error) { NDFREE(ndp, NDF_ONLY_PNBUF); diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index f19f7d8c15..665a01d81b 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -32,7 +32,7 @@ # # @(#)vnode_if.src 8.12 (Berkeley) 5/14/95 # $FreeBSD: src/sys/kern/vnode_if.src,v 1.29.2.3 2001/05/18 09:58:45 bp Exp $ -# $DragonFly: src/sys/kern/Attic/vnode_if.src,v 1.4 2003/06/26 05:55:14 dillon Exp $ +# $DragonFly: src/sys/kern/Attic/vnode_if.src,v 1.5 2003/10/09 22:27:19 dillon Exp $ # # @@ -73,7 +73,9 @@ vop_islocked { # vop_lookup { IN struct vnode *dvp; + IN struct namecache *par; INOUT struct vnode **vpp; + INOUT struct namecache **ncpp; IN struct componentname *cnp; }; @@ -85,7 +87,9 @@ vop_lookup { # vop_cachedlookup { IN struct vnode *dvp; + IN struct namecache *par; INOUT struct vnode **vpp; + INOUT struct namecache **ncpp; IN struct componentname *cnp; }; @@ -95,6 +99,7 @@ vop_cachedlookup { # vop_create { IN struct vnode *dvp; + IN struct namecache *par; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -105,6 +110,7 @@ vop_create { # vop_whiteout { IN struct vnode *dvp; + IN struct namecache *par; IN struct componentname *cnp; IN int flags; }; @@ -115,6 +121,7 @@ vop_whiteout { # vop_mknod { IN struct vnode *dvp; + IN struct namecache *par; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -261,6 +268,7 @@ vop_fsync { # vop_remove { IN struct vnode *dvp; + IN struct namecache *par; IN struct vnode *vp; IN struct componentname *cnp; }; @@ -271,6 +279,7 @@ vop_remove { # vop_link { IN struct vnode *tdvp; + IN struct namecache *par; IN struct vnode *vp; IN struct componentname *cnp; }; @@ -283,9 +292,11 @@ vop_link { # vop_rename { IN WILLRELE struct vnode *fdvp; + IN struct namecache *fpar; IN WILLRELE struct vnode *fvp; IN struct componentname *fcnp; IN WILLRELE struct vnode *tdvp; + IN struct namecache *tpar; IN WILLRELE struct vnode *tvp; IN struct componentname *tcnp; }; @@ -296,6 +307,7 @@ vop_rename { # vop_mkdir { IN struct vnode *dvp; + IN struct namecache *par; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -307,6 +319,7 @@ vop_mkdir { # vop_rmdir { IN struct vnode *dvp; + IN struct namecache *par; IN struct vnode *vp; IN struct componentname *cnp; }; @@ -317,6 +330,7 @@ vop_rmdir { # vop_symlink { IN struct vnode *dvp; + IN struct namecache *par; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 50dbffba43..d47c16a8a6 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -32,7 +32,7 @@ * * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/filedesc.h,v 1.19.2.5 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/filedesc.h,v 1.5 2003/08/20 07:31:21 rob Exp $ + * $DragonFly: src/sys/sys/filedesc.h,v 1.6 2003/10/09 22:27:20 dillon Exp $ */ #ifndef _SYS_FILEDESC_H_ @@ -58,13 +58,17 @@ #define NDEXTENT 50 /* 250 bytes in 256-byte alloc. */ struct klist; +struct namecache; struct filedesc { struct file **fd_ofiles; /* file structures for open files */ char *fd_ofileflags; /* per-process open file flags */ - struct vnode *fd_cdir; /* current directory */ - struct vnode *fd_rdir; /* root directory */ - struct vnode *fd_jdir; /* jail root directory */ + struct vnode *fd_cdir; /* current directory (phaseout) */ + struct vnode *fd_rdir; /* root directory (phaseout) */ + struct vnode *fd_jdir; /* jail root directory (phaseout) */ + struct namecache *fd_ncdir; /* current directory */ + struct namecache *fd_nrdir; /* root directory */ + struct namecache *fd_njdir; /* jail directory */ int fd_nfiles; /* number of open files allocated */ u_short fd_lastfile; /* high-water mark of fd_ofiles */ u_short fd_freefile; /* approx. next free file */ diff --git a/sys/sys/namecache.h b/sys/sys/namecache.h index 0292170c90..87d9fbf77c 100644 --- a/sys/sys/namecache.h +++ b/sys/sys/namecache.h @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/sys/namecache.h,v 1.1 2003/09/28 03:44:08 dillon Exp $ + * $DragonFly: src/sys/sys/namecache.h,v 1.2 2003/10/09 22:27:20 dillon Exp $ */ #ifndef _SYS_NAMECACHE_H_ @@ -87,20 +87,26 @@ typedef struct namecache *namecache_t; #define CINV_SELF 0x0001 /* invalidate a specific (dvp,vp) entry */ #define CINV_CHILDREN 0x0002 /* invalidate all children of vp */ +#define NCPNULL ((struct namecache *)NULL) /* placemarker */ +#define NCPPNULL ((struct namecache **)NULL) /* placemarker */ + #ifdef _KERNEL struct vop_lookup_args; struct componentname; struct mount; -int cache_lookup(struct vnode *dvp, struct vnode **vpp, +int cache_lookup(struct vnode *dvp, struct namecache *par, + struct vnode **vpp, struct namecache **ncpp, struct componentname *cnp); void cache_mount(struct vnode *dvp, struct vnode *tvp); -void cache_enter(struct vnode *dvp, struct vnode *vp, - struct componentname *cnp); +void cache_enter(struct vnode *dvp, struct namecache *par, + struct vnode *vp, struct componentname *cnp); void vfs_cache_setroot(struct vnode *vp); void cache_purge(struct vnode *vp); void cache_purgevfs (struct mount *mp); +void cache_drop(struct namecache *ncp); +struct namecache *cache_hold(struct namecache *ncp); int cache_leaf_test (struct vnode *vp); int vfs_cache_lookup(struct vop_lookup_args *ap); int textvp_fullpath (struct proc *p, char **retbuf, char **retfreebuf); diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 525a60c0f3..45ceb7bbec 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -32,7 +32,7 @@ * * @(#)namei.h 8.5 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/namei.h,v 1.29.2.2 2001/09/30 21:12:54 luigi Exp $ - * $DragonFly: src/sys/sys/namei.h,v 1.7 2003/09/29 18:52:08 dillon Exp $ + * $DragonFly: src/sys/sys/namei.h,v 1.8 2003/10/09 22:27:20 dillon Exp $ */ #ifndef _SYS_NAMEI_H_ @@ -87,6 +87,8 @@ struct nameidata { */ struct vnode *ni_vp; /* vnode of result */ struct vnode *ni_dvp; /* vnode of intermediate directory */ + struct namecache *ni_ncp; /* namecache of result */ + struct namecache *ni_dncp; /* namecache of intermediate dir */ /* * Shared between namei and lookup/commit routines. */ @@ -119,7 +121,9 @@ struct nameidata { #define CNP_NOCACHE 0x00000020 /* name must not be left in cache */ #define CNP_FOLLOW 0x00000040 /* follow symbolic links */ #define CNP_NOOBJ 0x00000080 /* don't create object */ -#define CNP_MODMASK 0x000000fc /* mask of operational modifiers */ +#define CNP_WANTDNCP 0x00400000 /* return target namecache refd */ +#define CNP_WANTNCP 0x00800000 /* return target namecache refd */ +#define CNP_MODMASK 0x00c000fc /* mask of operational modifiers */ /* * Namei parameter descriptors. * @@ -148,6 +152,8 @@ struct nameidata { #define CNP_WILLBEDIR 0x00080000 /* will be dir, allow trailing / */ #define CNP_ISUNICODE 0x00100000 /* current component name is unicode*/ #define CNP_PDIRUNLOCK 0x00200000 /* fs lookup() unlocked parent dir */ + /* (WANTDNCP) 0x00400000 */ + /* (WANTNCP) 0x00800000 */ #define CNP_PARAMASK 0x001fff00 /* mask of parameter descriptors */ /* * Initialization of an nameidata structure. @@ -180,7 +186,11 @@ NDINIT(struct nameidata *ndp, #define NDF_NO_VP_PUT 0x0000000c #define NDF_NO_STARTDIR_RELE 0x00000010 #define NDF_NO_FREE_PNBUF 0x00000020 +#define NDF_NO_DNCP_RELE 0x00000040 +#define NDF_NO_NCP_RELE 0x00000080 + #define NDF_ONLY_PNBUF (~NDF_NO_FREE_PNBUF) +#define NDF_ONLY_PNBUF_AND_NCPS (~(NDF_NO_FREE_PNBUF|NDF_NO_DNCP_RELE|NDF_NO_NCP_RELE)) void NDFREE (struct nameidata *, const uint); diff --git a/sys/vfs/coda/coda_vnops.c b/sys/vfs/coda/coda_vnops.c index 3e4bdee5ec..968856165d 100644 --- a/sys/vfs/coda/coda_vnops.c +++ b/sys/vfs/coda/coda_vnops.c @@ -28,7 +28,7 @@ * * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_vnops.c,v 1.22.2.1 2001/06/29 16:26:22 shafeeq Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.11 2003/09/29 18:52:12 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.12 2003/10/09 22:27:21 dillon Exp $ * */ @@ -1578,7 +1578,7 @@ coda_symlink(v) tdcp->c_flags &= ~C_VATTR; if (error == 0) - error = VOP_LOOKUP(tdvp, vpp, cnp); + error = VOP_LOOKUP(tdvp, NCPNULL, vpp, NCPPNULL, cnp); exit: CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); ) diff --git a/sys/vfs/gnu/ext2fs/ext2_lookup.c b/sys/vfs/gnu/ext2fs/ext2_lookup.c index 7f229bcb8b..bb161f4645 100644 --- a/sys/vfs/gnu/ext2fs/ext2_lookup.c +++ b/sys/vfs/gnu/ext2fs/ext2_lookup.c @@ -5,7 +5,7 @@ * University of Utah, Department of Computer Science * * $FreeBSD: src/sys/gnu/ext2fs/ext2_lookup.c,v 1.21.2.3 2002/11/17 02:02:42 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_lookup.c,v 1.7 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_lookup.c,v 1.8 2003/10/09 22:27:22 dillon Exp $ */ /* * Copyright (c) 1989, 1993 @@ -546,7 +546,7 @@ searchloop: * Insert name into cache (as non-existent) if appropriate. */ if ((cnp->cn_flags & CNP_MAKEENTRY) && nameiop != NAMEI_CREATE) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (ENOENT); found: @@ -693,7 +693,7 @@ found: * Insert name into cache if appropriate. */ if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (0); } diff --git a/sys/vfs/hpfs/hpfs_vnops.c b/sys/vfs/hpfs/hpfs_vnops.c index 3afe31d4c7..8e66b6da83 100644 --- a/sys/vfs/hpfs/hpfs_vnops.c +++ b/sys/vfs/hpfs/hpfs_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vnops.c,v 1.2.2.2 2002/01/15 18:35:09 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.10 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.11 2003/10/09 22:27:23 dillon Exp $ */ #include @@ -1263,7 +1263,7 @@ hpfs_lookup(ap) if ((flags & CNP_MAKEENTRY) && (!(flags & CNP_ISLASTCN) || (nameiop != NAMEI_DELETE && nameiop != NAMEI_CREATE))) - cache_enter(dvp, *ap->a_vpp, cnp); + cache_enter(dvp, NCPNULL, *ap->a_vpp, cnp); } return (error); } diff --git a/sys/vfs/isofs/cd9660/cd9660_lookup.c b/sys/vfs/isofs/cd9660/cd9660_lookup.c index 9407af869d..19f153445c 100644 --- a/sys/vfs/isofs/cd9660/cd9660_lookup.c +++ b/sys/vfs/isofs/cd9660/cd9660_lookup.c @@ -39,7 +39,7 @@ * * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 * $FreeBSD: src/sys/isofs/cd9660/cd9660_lookup.c,v 1.23.2.2 2001/11/04 06:19:47 dillon Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_lookup.c,v 1.7 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_lookup.c,v 1.8 2003/10/09 22:27:24 dillon Exp $ */ #include @@ -310,7 +310,7 @@ notfound: * Insert name into cache (as non-existent) if appropriate. */ if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); if (nameiop == NAMEI_CREATE || nameiop == NAMEI_RENAME) return (EROFS); return (ENOENT); @@ -390,7 +390,7 @@ found: * Insert name into cache if appropriate. */ if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (0); } diff --git a/sys/vfs/msdosfs/msdosfs_lookup.c b/sys/vfs/msdosfs/msdosfs_lookup.c index 24490ab998..27d70a4425 100644 --- a/sys/vfs/msdosfs/msdosfs_lookup.c +++ b/sys/vfs/msdosfs/msdosfs_lookup.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_lookup.c,v 1.30.2.1 2000/11/03 15:55:39 bp Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_lookup.c,v 1.6 2003/09/23 05:03:52 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_lookup.c,v 1.7 2003/10/09 22:27:26 dillon Exp $ */ /* $NetBSD: msdosfs_lookup.c,v 1.37 1997/11/17 15:36:54 ws Exp $ */ /*- @@ -375,7 +375,7 @@ notfound: * Insert name into cache (as non-existent) if appropriate. */ if ((cnp->cn_flags & CNP_MAKEENTRY) && nameiop != NAMEI_CREATE) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (ENOENT); found: @@ -551,7 +551,7 @@ foundroot: * Insert name into cache if appropriate. */ if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (0); } diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 5e68c0b0ab..2879ac2cbb 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.10 2003/09/29 18:52:16 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.11 2003/10/09 22:27:26 dillon Exp $ */ /* @@ -1727,7 +1727,8 @@ nfsrv_create(nfsd, slp, td, mrq) vap->va_mode = 0; if (vap->va_type == VREG || vap->va_type == VSOCK) { nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + error = VOP_CREATE(nd.ni_dvp, NCPNULL, &nd.ni_vp, + &nd.ni_cnd, vap); if (error) NDFREE(&nd, NDF_ONLY_PNBUF); else { @@ -1759,7 +1760,8 @@ nfsrv_create(nfsd, slp, td, mrq) vap->va_rdev = rdev; nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + error = VOP_MKNOD(nd.ni_dvp, NCPNULL, &nd.ni_vp, + &nd.ni_cnd, vap); if (error) { NDFREE(&nd, NDF_ONLY_PNBUF); goto nfsmreply0; @@ -1953,7 +1955,8 @@ nfsrv_mknod(nfsd, slp, td, mrq) vrele(nd.ni_startdir); nd.ni_startdir = NULL; nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + error = VOP_CREATE(nd.ni_dvp, NCPNULL, &nd.ni_vp, + &nd.ni_cnd, vap); if (error) NDFREE(&nd, NDF_ONLY_PNBUF); } else { @@ -1961,7 +1964,8 @@ nfsrv_mknod(nfsd, slp, td, mrq) goto out; nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + error = VOP_MKNOD(nd.ni_dvp, NCPNULL, &nd.ni_vp, + &nd.ni_cnd, vap); if (error) { NDFREE(&nd, NDF_ONLY_PNBUF); goto out; @@ -2112,7 +2116,7 @@ out: if (!error) { nqsrv_getl(nd.ni_dvp, ND_WRITE); nqsrv_getl(nd.ni_vp, ND_WRITE); - error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); + error = VOP_REMOVE(nd.ni_dvp, NCPNULL, nd.ni_vp, &nd.ni_cnd); NDFREE(&nd, NDF_ONLY_PNBUF); } } @@ -2298,8 +2302,8 @@ out: if (tvp) { nqsrv_getl(tvp, ND_WRITE); } - error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, - tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); + error = VOP_RENAME(fromnd.ni_dvp, NCPNULL, fromnd.ni_vp, &fromnd.ni_cnd, + tond.ni_dvp, NCPNULL, tond.ni_vp, &tond.ni_cnd); fromnd.ni_dvp = NULL; fromnd.ni_vp = NULL; tond.ni_dvp = NULL; @@ -2440,7 +2444,7 @@ out: if (!error) { nqsrv_getl(vp, ND_WRITE); nqsrv_getl(xp, ND_WRITE); - error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); + error = VOP_LINK(nd.ni_dvp, NCPNULL, vp, &nd.ni_cnd); NDFREE(&nd, NDF_ONLY_PNBUF); } /* fall through */ @@ -2560,7 +2564,7 @@ nfsrv_symlink(nfsd, slp, td, mrq) if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp); + error = VOP_SYMLINK(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, vap, pathcp); if (error) NDFREE(&nd, NDF_ONLY_PNBUF); else @@ -2736,7 +2740,7 @@ nfsrv_mkdir(nfsd, slp, td, mrq) if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; nqsrv_getl(nd.ni_dvp, ND_WRITE); - error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + error = VOP_MKDIR(nd.ni_dvp, NCPNULL, &nd.ni_vp, &nd.ni_cnd, vap); NDFREE(&nd, NDF_ONLY_PNBUF); vpexcl = 1; @@ -2865,7 +2869,7 @@ out: if (!error) { nqsrv_getl(nd.ni_dvp, ND_WRITE); nqsrv_getl(vp, ND_WRITE); - error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); + error = VOP_RMDIR(nd.ni_dvp, NCPNULL, nd.ni_vp, &nd.ni_cnd); } NDFREE(&nd, NDF_ONLY_PNBUF); diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index f75ddfe792..69e1c03485 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.12 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.13 2003/10/09 22:27:26 dillon Exp $ */ @@ -847,7 +847,7 @@ nfs_lookup(ap) wantparent = flags & (CNP_LOCKPARENT|CNP_WANTPARENT); nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); - if ((error = cache_lookup(dvp, vpp, cnp)) && error != ENOENT) { + if ((error = cache_lookup(dvp, NCPNULL, vpp, NCPPNULL, cnp)) && error != ENOENT) { struct vattr vattr; int vpid; @@ -976,7 +976,7 @@ nfs_lookup(ap) if ((cnp->cn_flags & CNP_MAKEENTRY) && (cnp->cn_nameiop != NAMEI_DELETE || !(flags & CNP_ISLASTCN))) { np->n_ctime = np->n_vattr.va_ctime.tv_sec; - cache_enter(dvp, newvp, cnp); + cache_enter(dvp, NCPNULL, newvp, cnp); } *vpp = newvp; nfsm_reqdone; @@ -1329,7 +1329,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) vput(newvp); } else { if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(dvp, newvp, cnp); + cache_enter(dvp, NCPNULL, newvp, cnp); *vpp = newvp; } VTONFS(dvp)->n_flag |= NMODIFIED; @@ -1466,7 +1466,7 @@ again: } if (!error) { if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(dvp, newvp, cnp); + cache_enter(dvp, NCPNULL, newvp, cnp); *ap->a_vpp = newvp; } VTONFS(dvp)->n_flag |= NMODIFIED; @@ -2416,7 +2416,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop) dp->d_type = IFTODT(VTTOIF(np->n_vattr.va_type)); ndp->ni_vp = newvp; - cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); + cache_enter(ndp->ni_dvp, NCPNULL, ndp->ni_vp, cnp); } } else { /* Just skip over the file handle */ diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index 352f68c5e8..aa8d6c3620 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vnops.c,v 1.9.2.4 2002/08/06 19:35:18 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.8 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.9 2003/10/09 22:27:26 dillon Exp $ * */ @@ -768,7 +768,7 @@ ntfs_lookup(ap) * check the name cache to see if the directory/name pair * we are looking for is known already. */ - if ((error = cache_lookup(ap->a_dvp, ap->a_vpp, cnp)) >= 0) + if ((error = cache_lookup(ap->a_dvp, NCPNULL, ap->a_vpp, NCPPNULL, cnp)) >= 0) return (error); #endif @@ -826,7 +826,7 @@ ntfs_lookup(ap) } if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(dvp, *ap->a_vpp, cnp); + cache_enter(dvp, NCPNULL, *ap->a_vpp, cnp); return (error); } diff --git a/sys/vfs/nullfs/null_vnops.c b/sys/vfs/nullfs/null_vnops.c index 382c13b05c..bcb5fe3dd1 100644 --- a/sys/vfs/nullfs/null_vnops.c +++ b/sys/vfs/nullfs/null_vnops.c @@ -38,7 +38,7 @@ * Ancestors: * @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92 * $FreeBSD: src/sys/miscfs/nullfs/null_vnops.c,v 1.38.2.6 2002/07/31 00:32:28 semenu Exp $ - * $DragonFly: src/sys/vfs/nullfs/null_vnops.c,v 1.7 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/null_vnops.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ * ...and... * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project * @@ -377,7 +377,7 @@ null_lookup(ap) */ ldvp = NULLVPTOLOWERVP(dvp); vp = lvp = NULL; - error = VOP_LOOKUP(ldvp, &lvp, cnp); + error = VOP_LOOKUP(ldvp, NCPNULL, &lvp, NCPPNULL, cnp); if (error == EJUSTRETURN && (flags & CNP_ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) && (cnp->cn_nameiop == NAMEI_CREATE || cnp->cn_nameiop == NAMEI_RENAME)) diff --git a/sys/vfs/nwfs/nwfs_io.c b/sys/vfs/nwfs/nwfs_io.c index 97981c5e85..4dd2f4129e 100644 --- a/sys/vfs/nwfs/nwfs_io.c +++ b/sys/vfs/nwfs/nwfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_io.c,v 1.6.2.1 2000/10/25 02:11:10 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.7 2003/08/07 21:54:35 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ * */ #include @@ -138,7 +138,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) { VTONW(newvp)->n_ctime = VTONW(newvp)->n_vattr.va_ctime.tv_sec; cn.cn_nameptr = dp.d_name; cn.cn_namelen = dp.d_namlen; - cache_enter(vp, newvp, &cn); + cache_enter(vp, NCPNULL, newvp, &cn); vput(newvp); } else error = 0; diff --git a/sys/vfs/nwfs/nwfs_vnops.c b/sys/vfs/nwfs/nwfs_vnops.c index 49def03768..3285cba695 100644 --- a/sys/vfs/nwfs/nwfs_vnops.c +++ b/sys/vfs/nwfs/nwfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vnops.c,v 1.6.2.3 2001/03/14 11:26:59 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.8 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.9 2003/10/09 22:27:27 dillon Exp $ */ #include #include @@ -467,7 +467,7 @@ nwfs_create(ap) *vpp = vp; } if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(dvp, vp, cnp); + cache_enter(dvp, NCPNULL, vp, cnp); } return (error); } @@ -945,7 +945,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & CNP_ISD if (error) return ENOENT; - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup(dvp, NCPNULL, vpp, NCPPNULL, cnp); NCPVNDEBUG("cache_lookup returned %d\n",error); if (error > 0) return error; @@ -1088,7 +1088,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & CNP_ISD } if ((cnp->cn_flags & CNP_MAKEENTRY)/* && !islastcn*/) { VTONW(*vpp)->n_ctime = VTONW(*vpp)->n_vattr.va_ctime.tv_sec; - cache_enter(dvp, *vpp, cnp); + cache_enter(dvp, NCPNULL, *vpp, cnp); } return (0); } diff --git a/sys/vfs/smbfs/smbfs_io.c b/sys/vfs/smbfs/smbfs_io.c index db8947568d..e372a53134 100644 --- a/sys/vfs/smbfs/smbfs_io.c +++ b/sys/vfs/smbfs/smbfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_io.c,v 1.3.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.7 2003/08/07 21:54:36 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ * */ #include @@ -163,7 +163,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) if (!error) { cn.cn_nameptr = de.d_name; cn.cn_namelen = de.d_namlen; - cache_enter(vp, newvp, &cn); + cache_enter(vp, NCPNULL, newvp, &cn); vput(newvp); } } diff --git a/sys/vfs/smbfs/smbfs_vnops.c b/sys/vfs/smbfs/smbfs_vnops.c index 0767941dd8..79999c33b9 100644 --- a/sys/vfs/smbfs/smbfs_vnops.c +++ b/sys/vfs/smbfs/smbfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.2.2.8 2003/04/04 08:57:23 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.8 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.9 2003/10/09 22:27:27 dillon Exp $ */ #include #include @@ -551,7 +551,7 @@ smbfs_create(ap) return error; *vpp = vp; if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(dvp, vp, cnp); + cache_enter(dvp, NCPNULL, vp, cnp); return error; } @@ -1170,7 +1170,7 @@ smbfs_lookup(ap) if (error) return ENOENT; - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup(dvp, NCPNULL, vpp, NCPPNULL, cnp); SMBVDEBUG("cache_lookup returned %d\n", error); if (error > 0) return error; @@ -1333,7 +1333,7 @@ smbfs_lookup(ap) } if ((cnp->cn_flags & CNP_MAKEENTRY)/* && !islastcn*/) { /* VTOSMB(*vpp)->n_ctime = VTOSMB(*vpp)->n_vattr.va_ctime.tv_sec;*/ - cache_enter(dvp, *vpp, cnp); + cache_enter(dvp, NCPNULL, *vpp, cnp); } return 0; } diff --git a/sys/vfs/ufs/ufs_lookup.c b/sys/vfs/ufs/ufs_lookup.c index 7cbccf2454..323353a9c6 100644 --- a/sys/vfs/ufs/ufs_lookup.c +++ b/sys/vfs/ufs/ufs_lookup.c @@ -37,7 +37,7 @@ * * @(#)ufs_lookup.c 8.15 (Berkeley) 6/16/95 * $FreeBSD: src/sys/ufs/ufs/ufs_lookup.c,v 1.33.2.7 2001/09/22 19:22:13 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_lookup.c,v 1.7 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_lookup.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ */ #include "opt_ufs.h" @@ -452,7 +452,7 @@ notfound: * Insert name into cache (as non-existent) if appropriate. */ if ((cnp->cn_flags & CNP_MAKEENTRY) && nameiop != NAMEI_CREATE) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (ENOENT); found: @@ -623,7 +623,7 @@ found: * Insert name into cache if appropriate. */ if (cnp->cn_flags & CNP_MAKEENTRY) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NCPNULL, *vpp, cnp); return (0); } diff --git a/sys/vfs/union/union_subr.c b/sys/vfs/union/union_subr.c index 9cc6a40ae5..5925e189df 100644 --- a/sys/vfs/union/union_subr.c +++ b/sys/vfs/union/union_subr.c @@ -36,7 +36,7 @@ * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_subr.c,v 1.43.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.8 2003/09/23 05:03:54 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.9 2003/10/09 22:27:27 dillon Exp $ */ #include @@ -941,7 +941,7 @@ union_mkshadow(um, dvp, cnp, vpp) /* VOP_LEASE: dvp is locked */ VOP_LEASE(dvp, td, cn.cn_cred, LEASE_WRITE); - error = VOP_MKDIR(dvp, vpp, &cn, &va); + error = VOP_MKDIR(dvp, NCPNULL, vpp, &cn, &va); if (cn.cn_flags & CNP_HASBUF) { zfree(namei_zone, cn.cn_pnbuf); cn.cn_flags &= ~CNP_HASBUF; @@ -994,7 +994,7 @@ union_mkwhiteout(um, dvp, cnp, path) /* VOP_LEASE: dvp is locked */ VOP_LEASE(dvp, td, cred, LEASE_WRITE); - error = VOP_WHITEOUT(dvp, &cn, NAMEI_CREATE); + error = VOP_WHITEOUT(dvp, NCPNULL, &cn, NAMEI_CREATE); if (cn.cn_flags & CNP_HASBUF) { zfree(namei_zone, cn.cn_pnbuf); cn.cn_flags &= ~CNP_HASBUF; @@ -1098,7 +1098,7 @@ union_vn_create(vpp, un, td) vap->va_type = VREG; vap->va_mode = cmode; VOP_LEASE(un->un_dirvp, td, cred, LEASE_WRITE); - error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap); + error = VOP_CREATE(un->un_dirvp, NCPNULL, &vp, &cn, vap); if (cn.cn_flags & CNP_HASBUF) { zfree(namei_zone, cn.cn_pnbuf); cn.cn_flags &= ~CNP_HASBUF; diff --git a/sys/vfs/union/union_vfsops.c b/sys/vfs/union/union_vfsops.c index 52707a095c..a50195f668 100644 --- a/sys/vfs/union/union_vfsops.c +++ b/sys/vfs/union/union_vfsops.c @@ -36,7 +36,7 @@ * * @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_vfsops.c,v 1.39.2.2 2001/10/25 19:18:53 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.6 2003/09/23 05:03:54 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.7 2003/10/09 22:27:27 dillon Exp $ */ /* @@ -222,7 +222,7 @@ union_mount(mp, path, data, ndp, td) * supports whiteout operations */ if ((mp->mnt_flag & MNT_RDONLY) == 0) { - error = VOP_WHITEOUT(um->um_uppervp, NULL, NAMEI_LOOKUP); + error = VOP_WHITEOUT(um->um_uppervp, NCPNULL, NULL, NAMEI_LOOKUP); if (error) goto bad; } diff --git a/sys/vfs/union/union_vnops.c b/sys/vfs/union/union_vnops.c index 430c075c30..382da6990e 100644 --- a/sys/vfs/union/union_vnops.c +++ b/sys/vfs/union/union_vnops.c @@ -36,7 +36,7 @@ * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $ - * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.8 2003/09/23 05:03:54 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.9 2003/10/09 22:27:27 dillon Exp $ */ #include @@ -216,7 +216,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) * changes will have been made to dvp, so we are set to return. */ - error = VOP_LOOKUP(dvp, &tdvp, cnp); + error = VOP_LOOKUP(dvp, NCPNULL, &tdvp, NCPPNULL, cnp); if (error) { UDEBUG(("dvp %p error %d flags %lx\n", dvp, error, cnp->cn_flags)); *vpp = NULL; @@ -645,7 +645,7 @@ union_create(ap) struct vnode *vp; struct mount *mp; - error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap); + error = VOP_CREATE(dvp, NCPNULL, &vp, cnp, ap->a_vap); if (error == 0) { mp = ap->a_dvp->v_mount; VOP_UNLOCK(vp, 0, td); @@ -673,7 +673,7 @@ union_whiteout(ap) int error = EOPNOTSUPP; if ((uppervp = union_lock_upper(un, cnp->cn_td)) != NULLVP) { - error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags); + error = VOP_WHITEOUT(un->un_uppervp, NCPNULL, cnp, ap->a_flags); union_unlock_upper(uppervp, cnp->cn_td); } return(error); @@ -701,7 +701,7 @@ union_mknod(ap) int error = EROFS; if ((dvp = union_lock_upper(dun, cnp->cn_td)) != NULL) { - error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap); + error = VOP_MKNOD(dvp, NCPNULL, ap->a_vpp, cnp, ap->a_vap); union_unlock_upper(dvp, cnp->cn_td); } return (error); @@ -1272,7 +1272,7 @@ union_remove(ap) if ((uppervp = union_lock_upper(un, td)) != NULLVP) { if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= CNP_DOWHITEOUT; - error = VOP_REMOVE(upperdvp, uppervp, cnp); + error = VOP_REMOVE(upperdvp, NCPNULL, uppervp, cnp); #if 0 /* XXX */ if (!error) @@ -1353,7 +1353,7 @@ union_link(ap) return (EROFS); VOP_UNLOCK(ap->a_tdvp, 0, td); /* unlock calling node */ - error = VOP_LINK(tdvp, vp, cnp); /* call link on upper */ + error = VOP_LINK(tdvp, NCPNULL, vp, cnp); /* call link on upper */ /* * We have to unlock tdvp prior to relocking our calling node in @@ -1509,7 +1509,7 @@ union_rename(ap) * cleanup to do. */ - return (VOP_RENAME(fdvp, fvp, ap->a_fcnp, tdvp, tvp, ap->a_tcnp)); + return (VOP_RENAME(fdvp, NCPNULL, fvp, ap->a_fcnp, tdvp, NCPNULL, tvp, ap->a_tcnp)); /* * Error. We still have to release / vput the various elements. @@ -1547,7 +1547,7 @@ union_mkdir(ap) if ((upperdvp = union_lock_upper(dun, td)) != NULLVP) { struct vnode *vp; - error = VOP_MKDIR(upperdvp, &vp, cnp, ap->a_vap); + error = VOP_MKDIR(upperdvp, NCPNULL, &vp, cnp, ap->a_vap); union_unlock_upper(upperdvp, td); if (error == 0) { @@ -1583,7 +1583,7 @@ union_rmdir(ap) if ((uppervp = union_lock_upper(un, td)) != NULLVP) { if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= CNP_DOWHITEOUT; - error = VOP_RMDIR(upperdvp, uppervp, ap->a_cnp); + error = VOP_RMDIR(upperdvp, NCPNULL, uppervp, ap->a_cnp); union_unlock_upper(uppervp, td); } else { error = union_mkwhiteout( @@ -1618,7 +1618,7 @@ union_symlink(ap) int error = EROFS; if ((dvp = union_lock_upper(dun, td)) != NULLVP) { - error = VOP_SYMLINK(dvp, ap->a_vpp, cnp, ap->a_vap, + error = VOP_SYMLINK(dvp, NCPNULL, ap->a_vpp, cnp, ap->a_vap, ap->a_target); union_unlock_upper(dvp, td); }