diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:29:00 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:29:00 +0000 |
commit | e676b3b5ac1041891584dd10c6bde24b82ebb2f2 (patch) | |
tree | 4a8713f46221eee3951af02dd885b8dd8a1bf869 /sys/vm/vnode_pager.c | |
parent | 62c64950f8e658fa60106b4d32e70ae3b6156d0d (diff) |
VFS Lite2 Changes
Diffstat (limited to 'sys/vm/vnode_pager.c')
-rw-r--r-- | sys/vm/vnode_pager.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 58eb3712a30..16788808a0a 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode_pager.c,v 1.3 1996/04/21 22:33:18 deraadt Exp $ */ +/* $OpenBSD: vnode_pager.c,v 1.4 1997/10/06 15:28:59 csapuntz Exp $ */ /* $NetBSD: vnode_pager.c,v 1.19 1996/03/16 23:15:27 christos Exp $ */ /* @@ -38,7 +38,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)vnode_pager.c 8.8 (Berkeley) 2/13/94 + * @(#)vnode_pager.c 8.10 (Berkeley) 5/14/95 */ /* @@ -280,7 +280,8 @@ vnode_pager_haspage(pager, offset) vm_pager_t pager; vm_offset_t offset; { - register vn_pager_t vnp = (vn_pager_t)pager->pg_data; + struct proc *p = curproc; /* XXX */ + vn_pager_t vnp = (vn_pager_t)pager->pg_data; daddr_t bn; int err; @@ -294,9 +295,9 @@ vnode_pager_haspage(pager, offset) * Lock the vnode first to make sure we have the most recent * version of the size. */ - VOP_LOCK(vnp->vnp_vp); + vn_lock(vnp->vnp_vp, LK_EXCLUSIVE | LK_RETRY, p); if (offset >= vnp->vnp_size) { - VOP_UNLOCK(vnp->vnp_vp); + VOP_UNLOCK(vnp->vnp_vp, 0, p); #ifdef DEBUG if (vpagerdebug & (VDB_FAIL|VDB_SIZE)) printf("vnode_pager_haspage: pg %p, off %lx, size %lx\n", @@ -315,7 +316,7 @@ vnode_pager_haspage(pager, offset) err = VOP_BMAP(vnp->vnp_vp, offset / vnp->vnp_vp->v_mount->mnt_stat.f_iosize, (struct vnode **)0, &bn, NULL); - VOP_UNLOCK(vnp->vnp_vp); + VOP_UNLOCK(vnp->vnp_vp, 0, p); if (err) { #ifdef DEBUG if (vpagerdebug & VDB_FAIL) @@ -425,7 +426,8 @@ void vnode_pager_umount(mp) register struct mount *mp; { - register vm_pager_t pager, npager; + struct proc *p = curproc; /* XXX */ + vm_pager_t pager, npager; struct vnode *vp; for (pager = vnode_pager_list.tqh_first; pager != NULL; pager = npager){ @@ -436,9 +438,9 @@ vnode_pager_umount(mp) npager = pager->pg_list.tqe_next; vp = ((vn_pager_t)pager->pg_data)->vnp_vp; if (mp == (struct mount *)0 || vp->v_mount == mp) { - VOP_LOCK(vp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); (void) vnode_pager_uncache(vp); - VOP_UNLOCK(vp); + VOP_UNLOCK(vp, 0, p); } } } @@ -455,15 +457,15 @@ boolean_t vnode_pager_uncache(vp) register struct vnode *vp; { - register vm_object_t object; + struct proc *p = curproc; /* XXX */ + vm_object_t object; boolean_t uncached; vm_pager_t pager; /* * Not a mapped vnode */ - pager = (vm_pager_t)vp->v_vmdata; - if (pager == NULL) + if (vp->v_type != VREG || (pager = (vm_pager_t)vp->v_vmdata) == NULL) return (TRUE); #ifdef DEBUG if (!VOP_ISLOCKED(vp)) { @@ -492,9 +494,9 @@ vnode_pager_uncache(vp) object = vm_object_lookup(pager); if (object) { uncached = (object->ref_count <= 1); - VOP_UNLOCK(vp); + VOP_UNLOCK(vp, 0, p); pager_cache(object, FALSE); - VOP_LOCK(vp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); } else uncached = TRUE; return(uncached); @@ -540,9 +542,9 @@ vnode_pager_io(vnp, mlist, npages, sync, rw) * read beyond EOF (returns error) * short read */ - VOP_LOCK(vnp->vnp_vp); + vn_lock(vnp->vnp_vp, LK_EXCLUSIVE | LK_RETRY, p); if (foff >= vnp->vnp_size) { - VOP_UNLOCK(vnp->vnp_vp); + VOP_UNLOCK(vnp->vnp_vp, 0, p); vm_pager_unmap_pages(kva, npages); #ifdef DEBUG if (vpagerdebug & VDB_SIZE) @@ -573,7 +575,7 @@ vnode_pager_io(vnp, mlist, npages, sync, rw) error = VOP_READ(vnp->vnp_vp, &auio, 0, p->p_ucred); else error = VOP_WRITE(vnp->vnp_vp, &auio, 0, p->p_ucred); - VOP_UNLOCK(vnp->vnp_vp); + VOP_UNLOCK(vnp->vnp_vp, 0, p); #ifdef DEBUG if (vpagerdebug & VDB_IO) { if (error || auio.uio_resid) |