aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. Bruce Fields2014-03-11 16:51:23 -0400
committerJ. Bruce Fields2014-05-30 17:31:58 -0400
commit6ff9897d2bcf4036dfd139caeddd6f0a51c9ca06 (patch)
tree5d01218af40788b8655b5322bef8755a0713f219
parent4f0cefbf389c28b0a2be34960797adb0c84ee43d (diff)
nfsd4: minor encode_read cleanup
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4xdr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8b3d24de9cac..8ce6c8d5ee8a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3076,18 +3076,20 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
len = maxcount;
v = 0;
- while (len > 0) {
+ while (len) {
+ int thislen;
+
page = *(resp->rqstp->rq_next_page);
if (!page) { /* ran out of pages */
maxcount -= len;
break;
}
+ thislen = min_t(long, len, PAGE_SIZE);
resp->rqstp->rq_vec[v].iov_base = page_address(page);
- resp->rqstp->rq_vec[v].iov_len =
- len < PAGE_SIZE ? len : PAGE_SIZE;
+ resp->rqstp->rq_vec[v].iov_len = thislen;
resp->rqstp->rq_next_page++;
v++;
- len -= PAGE_SIZE;
+ len -= thislen;
}
read->rd_vlen = v;