diff options
author | dyson <dyson@FreeBSD.org> | 1998-01-06 05:26:17 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1998-01-06 05:26:17 +0000 |
commit | cb2800cd94015c1a5a07a78ac1299961c8cbfee8 (patch) | |
tree | 458fd90f400f25f9120e71fd368963d5190181bb /sys/kern/vfs_lookup.c | |
parent | 082257799eb016d17f2ea10684dc8c250c8dce19 (diff) | |
download | FreeBSD-src-cb2800cd94015c1a5a07a78ac1299961c8cbfee8.zip FreeBSD-src-cb2800cd94015c1a5a07a78ac1299961c8cbfee8.tar.gz |
Make our v_usecount vnode reference count work identically to the
original BSD code. The association between the vnode and the vm_object
no longer includes reference counts. The major difference is that
vm_object's are no longer freed gratuitiously from the vnode, and so
once an object is created for the vnode, it will last as long as the
vnode does.
When a vnode object reference count is incremented, then the underlying
vnode reference count is incremented also. The two "objects" are now
more intimately related, and so the interactions are now much less
complex.
When vnodes are now normally placed onto the free queue with an object still
attached. The rundown of the object happens at vnode rundown time, and
happens with exactly the same filesystem semantics of the original VFS
code. There is absolutely no need for vnode_pager_uncache and other
travesties like that anymore.
A side-effect of these changes is that SMP locking should be much simpler,
the I/O copyin/copyout optimizations work, NFS should be more ponderable,
and further work on layered filesystems should be less frustrating, because
of the totally coherent management of the vnode objects and vnodes.
Please be careful with your system while running this code, but I would
greatly appreciate feedback as soon a reasonably possible.
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 8ceedd4..31754fd 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 - * $Id: vfs_lookup.c,v 1.21 1997/12/27 02:56:22 bde Exp $ + * $Id: vfs_lookup.c,v 1.22 1997/12/29 00:22:38 dyson Exp $ */ #include "opt_ktrace.h" @@ -165,6 +165,13 @@ namei(ndp) zfree(namei_zone, cnp->cn_pnbuf); else cnp->cn_flags |= HASBUF; + + if (ndp->ni_vp && ndp->ni_vp->v_type == VREG && + (cnp->cn_nameiop != DELETE) && + ((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == LOCKLEAF)) + vfs_object_create(ndp->ni_vp, + ndp->ni_cnd.cn_proc, ndp->ni_cnd.cn_cred, 1); + return (0); } if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1) @@ -538,8 +545,6 @@ nextname: if (!wantparent) vrele(ndp->ni_dvp); - vfs_object_create(dp, ndp->ni_cnd.cn_proc, ndp->ni_cnd.cn_cred, 1); - if ((cnp->cn_flags & LOCKLEAF) == 0) VOP_UNLOCK(dp, 0, p); return (0); @@ -687,7 +692,9 @@ relookup(dvp, vpp, cnp) if (!wantparent) vrele(dvp); - vfs_object_create(dp, cnp->cn_proc, cnp->cn_cred, 1); + if (dp->v_type == VREG && + ((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == LOCKLEAF)) + vfs_object_create(dp, cnp->cn_proc, cnp->cn_cred, 1); if ((cnp->cn_flags & LOCKLEAF) == 0) VOP_UNLOCK(dp, 0, p); |