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.
This commit is contained in:
David Greenman 1995-06-28 12:01:13 +00:00
parent 1d3c4bfc72
commit aa2cabb958
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9356
16 changed files with 152 additions and 174 deletions

View File

@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: vfs_bio.c,v 1.45 1995/05/21 21:38:49 davidg Exp $
* $Id: vfs_bio.c,v 1.46 1995/05/30 08:06:27 rgrimes Exp $
*/
/*
@ -725,10 +725,10 @@ inmem(struct vnode * vp, daddr_t blkno)
return 1;
if (vp->v_mount == 0)
return 0;
if ((vp->v_vmdata == 0) || (vp->v_flag & VVMIO) == 0)
if ((vp->v_object == 0) || (vp->v_flag & VVMIO) == 0)
return 0;
obj = (vm_object_t) vp->v_vmdata;
obj = vp->v_object;
tinc = PAGE_SIZE;
if (tinc > vp->v_mount->mnt_stat.f_iosize)
tinc = vp->v_mount->mnt_stat.f_iosize;
@ -848,7 +848,7 @@ loop:
vm_object_t obj;
int doingvmio;
if ((obj = (vm_object_t) vp->v_vmdata) && (vp->v_flag & VVMIO)) {
if ((obj = vp->v_object) && (vp->v_flag & VVMIO)) {
doingvmio = 1;
} else {
doingvmio = 0;
@ -1003,7 +1003,7 @@ allocbuf(struct buf * bp, int size)
bsize = vp->v_mount->mnt_stat.f_iosize;
if (bp->b_npages < desiredpages) {
obj = (vm_object_t) vp->v_vmdata;
obj = vp->v_object;
tinc = PAGE_SIZE;
if (tinc > bsize)
tinc = bsize;
@ -1181,7 +1181,7 @@ biodone(register struct buf * bp)
struct vnode *vp = bp->b_vp;
foff = vp->v_mount->mnt_stat.f_iosize * bp->b_lblkno;
obj = (vm_object_t) vp->v_vmdata;
obj = vp->v_object;
if (!obj) {
return;
}
@ -1311,7 +1311,7 @@ vfs_unbusy_pages(struct buf * bp)
if (bp->b_flags & B_VMIO) {
struct vnode *vp = bp->b_vp;
vm_object_t obj = (vm_object_t) vp->v_vmdata;
vm_object_t obj = vp->v_object;
vm_offset_t foff;
foff = vp->v_mount->mnt_stat.f_iosize * bp->b_lblkno;
@ -1354,7 +1354,7 @@ vfs_busy_pages(struct buf * bp, int clear_modify)
int i;
if (bp->b_flags & B_VMIO) {
vm_object_t obj = (vm_object_t) bp->b_vp->v_vmdata;
vm_object_t obj = bp->b_vp->v_object;
vm_offset_t foff = bp->b_vp->v_mount->mnt_stat.f_iosize * bp->b_lblkno;
int iocount = bp->b_bufsize;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.30 1995/05/21 21:38:51 davidg Exp $
* $Id: vfs_subr.c,v 1.31 1995/06/27 21:29:08 bde Exp $
*/
/*
@ -448,7 +448,6 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
register struct buf *bp;
struct buf *nbp, *blist;
int s, error;
vm_pager_t pager;
vm_object_t object;
if (flags & V_SAVE) {
@ -511,7 +510,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
/*
* Destroy the copy in the VM cache, too.
*/
object = (vm_object_t) vp->v_vmdata;
object = vp->v_object;
if (object != NULL) {
vm_object_lock(object);
vm_object_page_remove(object, 0, object->size,
@ -1532,11 +1531,11 @@ loop:
goto loop;
if (VOP_ISLOCKED(vp) && (flags != MNT_WAIT))
continue;
if (vp->v_vmdata &&
(((vm_object_t) vp->v_vmdata)->flags & OBJ_WRITEABLE)) {
if (vp->v_object &&
(((vm_object_t) vp->v_object)->flags & OBJ_WRITEABLE)) {
if (vget(vp, 1))
goto loop;
_vm_object_page_clean( (vm_object_t) vp->v_vmdata,
_vm_object_page_clean(vp->v_object,
0, 0, TRUE);
vput(vp);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.25 1995/05/21 21:38:52 davidg Exp $
* $Id: vfs_syscalls.c,v 1.26 1995/06/28 07:06:40 davidg Exp $
*/
#include <sys/param.h>
@ -1784,8 +1784,8 @@ fsync(p, uap, retval)
return (error);
vp = (struct vnode *)fp->f_data;
VOP_LOCK(vp);
if (vp->v_vmdata) {
_vm_object_page_clean((vm_object_t) vp->v_vmdata, 0, 0 ,0);
if (vp->v_object) {
_vm_object_page_clean(vp->v_object, 0, 0 ,0);
}
error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p);
VOP_UNLOCK(vp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.30 1995/05/21 21:38:51 davidg Exp $
* $Id: vfs_subr.c,v 1.31 1995/06/27 21:29:08 bde Exp $
*/
/*
@ -448,7 +448,6 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
register struct buf *bp;
struct buf *nbp, *blist;
int s, error;
vm_pager_t pager;
vm_object_t object;
if (flags & V_SAVE) {
@ -511,7 +510,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
/*
* Destroy the copy in the VM cache, too.
*/
object = (vm_object_t) vp->v_vmdata;
object = vp->v_object;
if (object != NULL) {
vm_object_lock(object);
vm_object_page_remove(object, 0, object->size,
@ -1532,11 +1531,11 @@ loop:
goto loop;
if (VOP_ISLOCKED(vp) && (flags != MNT_WAIT))
continue;
if (vp->v_vmdata &&
(((vm_object_t) vp->v_vmdata)->flags & OBJ_WRITEABLE)) {
if (vp->v_object &&
(((vm_object_t) vp->v_object)->flags & OBJ_WRITEABLE)) {
if (vget(vp, 1))
goto loop;
_vm_object_page_clean( (vm_object_t) vp->v_vmdata,
_vm_object_page_clean(vp->v_object,
0, 0, TRUE);
vput(vp);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.25 1995/05/21 21:38:52 davidg Exp $
* $Id: vfs_syscalls.c,v 1.26 1995/06/28 07:06:40 davidg Exp $
*/
#include <sys/param.h>
@ -1784,8 +1784,8 @@ fsync(p, uap, retval)
return (error);
vp = (struct vnode *)fp->f_data;
VOP_LOCK(vp);
if (vp->v_vmdata) {
_vm_object_page_clean((vm_object_t) vp->v_vmdata, 0, 0 ,0);
if (vp->v_object) {
_vm_object_page_clean(vp->v_object, 0, 0 ,0);
}
error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p);
VOP_UNLOCK(vp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
* $Id: vfs_vnops.c,v 1.10 1995/05/10 18:59:11 davidg Exp $
* $Id: vfs_vnops.c,v 1.11 1995/05/30 08:06:35 rgrimes Exp $
*/
#include <sys/param.h>
@ -161,15 +161,11 @@ vn_open(ndp, fmode, cmode)
vm_pager_t pager;
retry:
if ((vp->v_flag & VVMIO) == 0) {
pager = (vm_pager_t) vnode_pager_alloc(vp, 0, 0, 0);
object = (vm_object_t) vp->v_vmdata;
if (object->pager != pager)
panic("vn_open: pager/object mismatch");
(void) vm_object_lookup(pager);
pager_cache(object, TRUE);
if (vnode_pager_alloc(vp, 0, 0, 0) == NULL)
panic("vn_open: 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)) {
VOP_UNLOCK(vp);
tsleep(object, PVM, "vodead", 0);
@ -244,9 +240,9 @@ vn_close(vp, flags, cred, p)
*/
if (vp->v_flag & VVMIO) {
vrele(vp);
if( vp->v_vmdata == NULL)
if (vp->v_object == NULL)
panic("vn_close: VMIO object missing");
vm_object_deallocate( (vm_object_t) vp->v_vmdata);
vm_object_deallocate(vp->v_object);
} else
vrele(vp);
return (error);

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.19 1995/04/09 06:03:33 davidg Exp $
* $Id: vnode.h,v 1.20 1995/04/20 03:18:19 julian Exp $
*/
#ifndef _SYS_VNODE_H_
@ -95,7 +95,7 @@ struct vnode {
int v_clen; /* length of current cluster */
int v_ralen; /* Read-ahead length */
daddr_t v_maxra; /* last readahead block */
caddr_t v_vmdata; /* Place to store VM pager */
void *v_object; /* Place to store VM object */
enum vtagtype v_tag; /* type of underlying data */
void *v_data; /* private data for fs */
};

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
* $Id: ffs_vfsops.c,v 1.20 1995/05/19 03:26:56 davidg Exp $
* $Id: ffs_vfsops.c,v 1.21 1995/05/30 08:15:03 rgrimes Exp $
*/
#include <sys/param.h>
@ -698,11 +698,11 @@ loop:
if (VOP_ISLOCKED(vp))
continue;
ip = VTOI(vp);
if (vp->v_vmdata &&
(((vm_object_t) vp->v_vmdata)->flags & OBJ_WRITEABLE)) {
if (vp->v_object &&
(((vm_object_t) vp->v_object)->flags & OBJ_WRITEABLE)) {
if (vget(vp, 1))
goto loop;
_vm_object_page_clean( (vm_object_t) vp->v_vmdata,
_vm_object_page_clean(vp->v_object,
0, 0, 0);
vput(vp);
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_vnops.c 8.5 (Berkeley) 12/30/93
* $Id: lfs_vnops.c,v 1.9 1995/05/30 08:15:27 rgrimes Exp $
* $Id: lfs_vnops.c,v 1.10 1995/06/28 07:06:53 davidg Exp $
*/
#include <sys/param.h>
@ -238,8 +238,8 @@ lfs_fsync(ap)
* If the vnode has an object, then flush all of the dirty pages
* into the buffer cache.
*/
if (ap->a_vp->v_vmdata)
_vm_object_page_clean((vm_object_t)ap->a_vp->v_vmdata, 0, 0, 0);
if (ap->a_vp->v_object)
_vm_object_page_clean(ap->a_vp->v_object, 0, 0, 0);
error = (VOP_UPDATE(ap->a_vp, &tv, &tv,
ap->a_waitfor == MNT_WAIT ? LFS_SYNC : 0));

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.39 1995/05/18 02:59:26 davidg Exp $
* $Id: vnode_pager.c,v 1.40 1995/05/30 08:16:23 rgrimes Exp $
*/
/*
@ -141,9 +141,9 @@ vnode_pager_alloc(handle, size, prot, offset)
* with vm_pager_lookup.
*/
vp = (struct vnode *) handle;
while ((object = (vm_object_t) vp->v_vmdata) &&
while ((object = vp->v_object) &&
(object->flags & OBJ_DEAD))
tsleep((caddr_t) object, PVM, "vadead", 0);
tsleep(object, PVM, "vadead", 0);
pager = NULL;
if (object != NULL)
@ -188,7 +188,7 @@ vnode_pager_alloc(handle, size, prot, offset)
pager->pg_type = PG_VNODE;
pager->pg_ops = &vnodepagerops;
pager->pg_data = (caddr_t) vnp;
vp->v_vmdata = (caddr_t) object;
vp->v_object = (caddr_t) object;
} else {
/*
@ -214,7 +214,7 @@ vnode_pager_dealloc(pager)
if (vp) {
int s = splbio();
object = (vm_object_t) vp->v_vmdata;
object = vp->v_object;
if (object) {
while (object->paging_in_progress) {
object->flags |= OBJ_PIPWNT;
@ -223,7 +223,7 @@ vnode_pager_dealloc(pager)
}
splx(s);
vp->v_vmdata = NULL;
vp->v_object = NULL;
vp->v_flag &= ~(VTEXT | VVMIO);
vp->v_flag |= VAGE;
vrele(vp);
@ -344,13 +344,13 @@ vnode_pager_setsize(vp, nsize)
/*
* Not a mapped vnode
*/
if (vp == NULL || vp->v_type != VREG || vp->v_vmdata == NULL)
if (vp == NULL || vp->v_type != VREG || vp->v_object == NULL)
return;
/*
* Hasn't changed size
*/
object = (vm_object_t) vp->v_vmdata;
object = vp->v_object;
if (object == NULL)
return;
if ((pager = object->pager) == NULL)
@ -432,7 +432,7 @@ vnode_pager_uncache(vp)
/*
* Not a mapped vnode
*/
object = (vm_object_t) vp->v_vmdata;
object = vp->v_object;
if (object == NULL)
return (TRUE);
@ -580,7 +580,7 @@ vnode_pager_input_smlfs(vnp, m)
s = splbio();
while ((bp->b_flags & B_DONE) == 0) {
tsleep((caddr_t) bp, PVM, "vnsrd", 0);
tsleep(bp, PVM, "vnsrd", 0);
}
splx(s);
if ((bp->b_flags & B_ERROR) != 0)
@ -855,7 +855,7 @@ vnode_pager_input(vnp, m, count, reqpage)
/* we definitely need to be at splbio here */
while ((bp->b_flags & B_DONE) == 0) {
tsleep((caddr_t) bp, PVM, "vnread", 0);
tsleep(bp, PVM, "vnread", 0);
}
splx(s);
if ((bp->b_flags & B_ERROR) != 0)