aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfsclient/nfs_clbio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/nfsclient/nfs_clbio.c')
-rw-r--r--sys/fs/nfsclient/nfs_clbio.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 53ba7efe418f..5647868011ac 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -101,6 +101,10 @@ ncl_getpages(struct vop_getpages_args *ap)
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;
if ((object = vp->v_object) == NULL) {
ncl_printf("nfs_getpages: called with non-merged cache vnode??\n");
@@ -132,12 +136,18 @@ ncl_getpages(struct vop_getpages_args *ap)
* If the requested page is partially valid, just return it and
* allow the pager to zero-out the blanks. Partially valid pages
* can only occur at the file EOF.
+ *
+ * XXXGL: is that true for NFS, where short read can occur???
*/
- if (pages[ap->a_reqpage]->valid != 0) {
- vm_pager_free_nonreq(object, pages, ap->a_reqpage, npages,
- FALSE);
- return (VM_PAGER_OK);
+ 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;
}
+ VM_OBJECT_WUNLOCK(object);
/*
* We use only the kva address for the buffer, but this is extremely
@@ -167,8 +177,6 @@ ncl_getpages(struct vop_getpages_args *ap)
if (error && (uio.uio_resid == count)) {
ncl_printf("nfs_getpages: error %d\n", error);
- vm_pager_free_nonreq(object, pages, ap->a_reqpage, npages,
- FALSE);
return (VM_PAGER_ERROR);
}
@@ -212,8 +220,6 @@ ncl_getpages(struct vop_getpages_args *ap)
*/
;
}
- if (i != ap->a_reqpage)
- vm_page_readahead_finish(m);
}
VM_OBJECT_WUNLOCK(object);
return (0);