aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/fuse
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2015-12-16 23:48:50 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2015-12-16 23:48:50 +0000
commitf17f88d3e023596500957a253809e018e30ef11e (patch)
treec51953917ff3f8c7c48a8cdf8fac8c7747565f90 /sys/fs/fuse
parentfeea5135640a0853e35a09fc3eb1d567a51721de (diff)
downloadsrc-f17f88d3e023596500957a253809e018e30ef11e.tar.gz
src-f17f88d3e023596500957a253809e018e30ef11e.zip
Fix breakage caused by r292373 in ZFS/FUSE/NFS/SMBFS.
With the new VOP_GETPAGES() KPI the "count" argument counts pages already, and doesn't need to be translated from bytes to pages. While here make it consistent that *rbehind and *rahead are updated only if we doesn't return error. Pointy hat to: glebius
Notes
Notes: svn path=/head/; revision=292386
Diffstat (limited to 'sys/fs/fuse')
-rw-r--r--sys/fs/fuse/fuse_vnops.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index 50318647a2f5..74dbcb2b5cd3 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);
}
/*