diff options
author | dg <dg@FreeBSD.org> | 1995-06-28 12:01:13 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-06-28 12:01:13 +0000 |
commit | 3c7c1dd62f54ce78b1593682d1ef227bab8bdeef (patch) | |
tree | 1798a14b6ddbde5307f451f4fd93057ae9ab0a0e /sys/nfsserver | |
parent | 2a67a27d9b7421ecbfc21fa31a18e6101006c82a (diff) | |
download | FreeBSD-src-3c7c1dd62f54ce78b1593682d1ef227bab8bdeef.zip FreeBSD-src-3c7c1dd62f54ce78b1593682d1ef227bab8bdeef.tar.gz |
1) Converted v_vmdata to v_object.
2) Removed unnecessary vm_object_lookup()/pager_cache(object, TRUE) pairs
after vnode_pager_alloc() calls - the object is already guaranteed to be
persistent.
3) Removed some gratuitous casts.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 18 | ||||
-rw-r--r-- | sys/nfsserver/nfs_srvsubs.c | 46 |
2 files changed, 30 insertions, 34 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index ad1da60..d8659d1 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94 - * $Id: nfs_serv.c,v 1.16 1995/06/27 11:06:37 dfr Exp $ + * $Id: nfs_serv.c,v 1.17 1995/06/28 07:06:50 davidg Exp $ */ /* @@ -1714,11 +1714,11 @@ out: nqsrv_getl(nd.ni_dvp, ND_WRITE); nqsrv_getl(vp, ND_WRITE); - if ((vp->v_flag & VVMIO) && vp->v_vmdata) + if ((vp->v_flag & VVMIO) && vp->v_object) deallocobj = 1; error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); if (error == 0 && deallocobj) - vm_object_deallocate((vm_object_t) vp->v_vmdata); + vm_object_deallocate(vp->v_object); } else { VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) @@ -1891,17 +1891,17 @@ out: nqsrv_getl(tdvp, ND_WRITE); if (tvp) { nqsrv_getl(tvp, ND_WRITE); - if ((tvp->v_flag & VVMIO) && tvp->v_vmdata) + if ((tvp->v_flag & VVMIO) && tvp->v_object) deallocobjto = 1; } - if ((fvp->v_flag & VVMIO) && fvp->v_vmdata) + if ((fvp->v_flag & VVMIO) && fvp->v_object) deallocobjfrom = 1; error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); if (deallocobjfrom) - vm_object_deallocate((vm_object_t) fvp->v_vmdata); + vm_object_deallocate(fvp->v_object); if (deallocobjto) - vm_object_deallocate((vm_object_t) tvp->v_vmdata); + vm_object_deallocate(tvp->v_object); } else { VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd); @@ -2143,11 +2143,11 @@ nfsrv_symlink(nfsd, slp, procp, mrq) goto out; } nqsrv_getl(nd.ni_dvp, ND_WRITE); - if ((ovp = nd.ni_vp) && (ovp->v_flag & VVMIO) && ovp->v_vmdata) + if ((ovp = nd.ni_vp) && (ovp->v_flag & VVMIO) && ovp->v_object) deallocobj = 1; error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp); if (error == 0 && deallocobj) - vm_object_deallocate( (vm_object_t) ovp->v_vmdata); + vm_object_deallocate(ovp->v_object); if (error) nfsrv_vrele(nd.ni_startdir); else { diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 350ba46..86bb5a9 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.16 1995/06/14 06:23:38 joerg Exp $ + * $Id: nfs_subs.c,v 1.17 1995/06/27 11:06:47 dfr Exp $ */ /* @@ -1896,54 +1896,50 @@ nfsrv_errmap(nd, err) } int -nfsrv_vmio( struct vnode *vp) { +nfsrv_vmio(struct vnode *vp) { vm_object_t object; vm_pager_t pager; - if( (vp == NULL) || (vp->v_type != VREG)) + if ((vp == NULL) || (vp->v_type != VREG)) return 1; retry: - if( (vp->v_flag & VVMIO) == 0) { - pager = (vm_pager_t) vnode_pager_alloc((caddr_t) vp, 0, 0, 0); - object = (vm_object_t) vp->v_vmdata; - if( object->pager != pager) - panic("nfsrv_vmio: pager/object mismatch"); - (void) vm_object_lookup( pager); - pager_cache( object, TRUE); + if ((vp->v_flag & VVMIO) == 0) { + if (vnode_pager_alloc(vp, 0, 0, 0) == NULL) + panic("nfsrv_vmio: failed to alloc pager"); vp->v_flag |= VVMIO; } else { - if( (object = (vm_object_t)vp->v_vmdata) && + if ((object = vp->v_object) && (object->flags & OBJ_DEAD)) { - tsleep( (caddr_t) object, PVM, "nfdead", 0); + tsleep(object, PVM, "nfdead", 0); goto retry; } - if( !object) + if (!object) panic("nfsrv_vmio: VMIO object missing"); pager = object->pager; - if( !pager) + if (!pager) panic("nfsrv_vmio: VMIO pager missing"); - (void) vm_object_lookup( pager); + (void) vm_object_lookup(pager); } return 0; } int -nfsrv_vput( struct vnode *vp) { - if( (vp->v_flag & VVMIO) && vp->v_vmdata) { - vput( vp); - vm_object_deallocate( (vm_object_t) vp->v_vmdata); +nfsrv_vput(struct vnode *vp) { + if ((vp->v_flag & VVMIO) && vp->v_object) { + vput(vp); + vm_object_deallocate(vp->v_object); } else { - vput( vp); + vput(vp); } return 0; } int -nfsrv_vrele( struct vnode *vp) { - if( (vp->v_flag & VVMIO) && vp->v_vmdata) { - vrele( vp); - vm_object_deallocate( (vm_object_t) vp->v_vmdata); +nfsrv_vrele(struct vnode *vp) { + if ((vp->v_flag & VVMIO) && vp->v_object) { + vrele(vp); + vm_object_deallocate(vp->v_object); } else { - vrele( vp); + vrele(vp); } return 0; } |