diff options
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/fuse/fuse_vnops.c | 24 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clbio.c | 25 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_io.c | 24 |
3 files changed, 30 insertions, 43 deletions
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 5031864..74dbcb2 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -1752,17 +1752,12 @@ fuse_vnop_getpages(struct vop_getpages_args *ap) td = curthread; /* XXX */ cred = curthread->td_ucred; /* XXX */ pages = ap->a_m; - count = ap->a_count; - if (ap->a_rbehind) - *ap->a_rbehind = 0; - if (ap->a_rahead) - *ap->a_rahead = 0; + npages = ap->a_count; if (!fsess_opt_mmap(vnode_mount(vp))) { FS_DEBUG("called on non-cacheable vnode??\n"); return (VM_PAGER_ERROR); } - npages = btoc(count); /* * If the last page is partially valid, just return it and allow @@ -1773,13 +1768,8 @@ fuse_vnop_getpages(struct vop_getpages_args *ap) * but still somewhat disconnected from the kernel? */ VM_OBJECT_WLOCK(vp->v_object); - if (pages[npages - 1]->valid != 0) { - if (--npages == 0) { - VM_OBJECT_WUNLOCK(vp->v_object); - return (VM_PAGER_OK); - } - count = npages << PAGE_SHIFT; - } + if (pages[npages - 1]->valid != 0 && --npages == 0) + goto out; VM_OBJECT_WUNLOCK(vp->v_object); /* @@ -1793,6 +1783,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap) PCPU_INC(cnt.v_vnodein); PCPU_ADD(cnt.v_vnodepgsin, npages); + count = npages << PAGE_SHIFT; iov.iov_base = (caddr_t)kva; iov.iov_len = count; uio.uio_iov = &iov; @@ -1852,8 +1843,13 @@ fuse_vnop_getpages(struct vop_getpages_args *ap) } } fuse_vm_page_unlock_queues(); +out: VM_OBJECT_WUNLOCK(vp->v_object); - return 0; + if (ap->a_rbehind) + *ap->a_rbehind = 0; + if (ap->a_rahead) + *ap->a_rahead = 0; + return (VM_PAGER_OK); } /* diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 56478680..3498dc0 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -100,11 +100,7 @@ ncl_getpages(struct vop_getpages_args *ap) cred = curthread->td_ucred; /* XXX */ nmp = VFSTONFS(vp->v_mount); pages = ap->a_m; - count = ap->a_count; - if (ap->a_rbehind) - *ap->a_rbehind = 0; - if (ap->a_rahead) - *ap->a_rahead = 0; + npages = ap->a_count; if ((object = vp->v_object) == NULL) { ncl_printf("nfs_getpages: called with non-merged cache vnode??\n"); @@ -130,8 +126,6 @@ ncl_getpages(struct vop_getpages_args *ap) } else mtx_unlock(&nmp->nm_mtx); - npages = btoc(count); - /* * If the requested page is partially valid, just return it and * allow the pager to zero-out the blanks. Partially valid pages @@ -140,13 +134,8 @@ ncl_getpages(struct vop_getpages_args *ap) * XXXGL: is that true for NFS, where short read can occur??? */ VM_OBJECT_WLOCK(object); - if (pages[npages - 1]->valid != 0) { - if (--npages == 0) { - VM_OBJECT_WUNLOCK(object); - return (VM_PAGER_OK); - } - count = npages << PAGE_SHIFT; - } + if (pages[npages - 1]->valid != 0 && --npages == 0) + goto out; VM_OBJECT_WUNLOCK(object); /* @@ -160,6 +149,7 @@ ncl_getpages(struct vop_getpages_args *ap) PCPU_INC(cnt.v_vnodein); PCPU_ADD(cnt.v_vnodepgsin, npages); + count = npages << PAGE_SHIFT; iov.iov_base = (caddr_t) kva; iov.iov_len = count; uio.uio_iov = &iov; @@ -221,8 +211,13 @@ ncl_getpages(struct vop_getpages_args *ap) ; } } +out: VM_OBJECT_WUNLOCK(object); - return (0); + if (ap->a_rbehind) + *ap->a_rbehind = 0; + if (ap->a_rahead) + *ap->a_rahead = 0; + return (VM_PAGER_OK); } /* diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 5fe6f11..4de3827 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -449,12 +449,7 @@ smbfs_getpages(ap) np = VTOSMB(vp); smp = VFSTOSMBFS(vp->v_mount); pages = ap->a_m; - count = ap->a_count; - npages = btoc(count); - if (ap->a_rbehind) - *ap->a_rbehind = 0; - if (ap->a_rahead) - *ap->a_rahead = 0; + npages = ap->a_count; /* * If the requested page is partially valid, just return it and @@ -464,13 +459,8 @@ smbfs_getpages(ap) * XXXGL: is that true for SMB filesystem? */ VM_OBJECT_WLOCK(object); - if (pages[npages - 1]->valid != 0) { - if (--npages == 0) { - VM_OBJECT_WUNLOCK(object); - return (VM_PAGER_OK); - } - count = npages << PAGE_SHIFT; - } + if (pages[npages - 1]->valid != 0 && --npages == 0) + goto out; VM_OBJECT_WUNLOCK(object); scred = smbfs_malloc_scred(); @@ -483,6 +473,7 @@ smbfs_getpages(ap) PCPU_INC(cnt.v_vnodein); PCPU_ADD(cnt.v_vnodepgsin, npages); + count = npages << PAGE_SHIFT; iov.iov_base = (caddr_t) kva; iov.iov_len = count; uio.uio_iov = &iov; @@ -536,8 +527,13 @@ smbfs_getpages(ap) ; } } +out: VM_OBJECT_WUNLOCK(object); - return 0; + if (ap->a_rbehind) + *ap->a_rbehind = 0; + if (ap->a_rahead) + *ap->a_rahead = 0; + return (VM_PAGER_OK); #endif /* SMBFS_RWGENERIC */ } |