diff options
Diffstat (limited to 'fs/nfsd/nfsxdr.c')
-rw-r--r-- | fs/nfsd/nfsxdr.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index e3a0797dd56b..1135c0d14557 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/xdr.c | 2 | * linux/fs/nfsd/nfsxdr.c |
3 | * | 3 | * |
4 | * XDR support for nfsd | 4 | * XDR support for nfsd |
5 | * | 5 | * |
@@ -254,19 +254,18 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | |||
254 | len = args->count = ntohl(*p++); | 254 | len = args->count = ntohl(*p++); |
255 | p++; /* totalcount - unused */ | 255 | p++; /* totalcount - unused */ |
256 | 256 | ||
257 | if (len > NFSSVC_MAXBLKSIZE) | 257 | if (len > NFSSVC_MAXBLKSIZE_V2) |
258 | len = NFSSVC_MAXBLKSIZE; | 258 | len = NFSSVC_MAXBLKSIZE_V2; |
259 | 259 | ||
260 | /* set up somewhere to store response. | 260 | /* set up somewhere to store response. |
261 | * We take pages, put them on reslist and include in iovec | 261 | * We take pages, put them on reslist and include in iovec |
262 | */ | 262 | */ |
263 | v=0; | 263 | v=0; |
264 | while (len > 0) { | 264 | while (len > 0) { |
265 | pn=rqstp->rq_resused; | 265 | pn = rqstp->rq_resused++; |
266 | svc_take_page(rqstp); | 266 | rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_respages[pn]); |
267 | args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]); | 267 | rqstp->rq_vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE; |
268 | args->vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE; | 268 | len -= rqstp->rq_vec[v].iov_len; |
269 | len -= args->vec[v].iov_len; | ||
270 | v++; | 269 | v++; |
271 | } | 270 | } |
272 | args->vlen = v; | 271 | args->vlen = v; |
@@ -286,21 +285,21 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | |||
286 | args->offset = ntohl(*p++); /* offset */ | 285 | args->offset = ntohl(*p++); /* offset */ |
287 | p++; /* totalcount */ | 286 | p++; /* totalcount */ |
288 | len = args->len = ntohl(*p++); | 287 | len = args->len = ntohl(*p++); |
289 | args->vec[0].iov_base = (void*)p; | 288 | rqstp->rq_vec[0].iov_base = (void*)p; |
290 | args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - | 289 | rqstp->rq_vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - |
291 | (((void*)p) - rqstp->rq_arg.head[0].iov_base); | 290 | (((void*)p) - rqstp->rq_arg.head[0].iov_base); |
292 | if (len > NFSSVC_MAXBLKSIZE) | 291 | if (len > NFSSVC_MAXBLKSIZE_V2) |
293 | len = NFSSVC_MAXBLKSIZE; | 292 | len = NFSSVC_MAXBLKSIZE_V2; |
294 | v = 0; | 293 | v = 0; |
295 | while (len > args->vec[v].iov_len) { | 294 | while (len > rqstp->rq_vec[v].iov_len) { |
296 | len -= args->vec[v].iov_len; | 295 | len -= rqstp->rq_vec[v].iov_len; |
297 | v++; | 296 | v++; |
298 | args->vec[v].iov_base = page_address(rqstp->rq_argpages[v]); | 297 | rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]); |
299 | args->vec[v].iov_len = PAGE_SIZE; | 298 | rqstp->rq_vec[v].iov_len = PAGE_SIZE; |
300 | } | 299 | } |
301 | args->vec[v].iov_len = len; | 300 | rqstp->rq_vec[v].iov_len = len; |
302 | args->vlen = v+1; | 301 | args->vlen = v+1; |
303 | return args->vec[0].iov_len > 0; | 302 | return rqstp->rq_vec[0].iov_len > 0; |
304 | } | 303 | } |
305 | 304 | ||
306 | int | 305 | int |
@@ -333,8 +332,7 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinka | |||
333 | { | 332 | { |
334 | if (!(p = decode_fh(p, &args->fh))) | 333 | if (!(p = decode_fh(p, &args->fh))) |
335 | return 0; | 334 | return 0; |
336 | svc_take_page(rqstp); | 335 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused++]); |
337 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); | ||
338 | 336 | ||
339 | return xdr_argsize_check(rqstp, p); | 337 | return xdr_argsize_check(rqstp, p); |
340 | } | 338 | } |
@@ -375,8 +373,7 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | |||
375 | if (args->count > PAGE_SIZE) | 373 | if (args->count > PAGE_SIZE) |
376 | args->count = PAGE_SIZE; | 374 | args->count = PAGE_SIZE; |
377 | 375 | ||
378 | svc_take_page(rqstp); | 376 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused++]); |
379 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); | ||
380 | 377 | ||
381 | return xdr_argsize_check(rqstp, p); | 378 | return xdr_argsize_check(rqstp, p); |
382 | } | 379 | } |
@@ -416,7 +413,6 @@ nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | |||
416 | rqstp->rq_res.page_len = resp->len; | 413 | rqstp->rq_res.page_len = resp->len; |
417 | if (resp->len & 3) { | 414 | if (resp->len & 3) { |
418 | /* need to pad the tail */ | 415 | /* need to pad the tail */ |
419 | rqstp->rq_restailpage = 0; | ||
420 | rqstp->rq_res.tail[0].iov_base = p; | 416 | rqstp->rq_res.tail[0].iov_base = p; |
421 | *p = 0; | 417 | *p = 0; |
422 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3); | 418 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3); |
@@ -436,7 +432,6 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p, | |||
436 | rqstp->rq_res.page_len = resp->count; | 432 | rqstp->rq_res.page_len = resp->count; |
437 | if (resp->count & 3) { | 433 | if (resp->count & 3) { |
438 | /* need to pad the tail */ | 434 | /* need to pad the tail */ |
439 | rqstp->rq_restailpage = 0; | ||
440 | rqstp->rq_res.tail[0].iov_base = p; | 435 | rqstp->rq_res.tail[0].iov_base = p; |
441 | *p = 0; | 436 | *p = 0; |
442 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3); | 437 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3); |
@@ -463,7 +458,7 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, | |||
463 | { | 458 | { |
464 | struct kstatfs *stat = &resp->stats; | 459 | struct kstatfs *stat = &resp->stats; |
465 | 460 | ||
466 | *p++ = htonl(NFSSVC_MAXBLKSIZE); /* max transfer size */ | 461 | *p++ = htonl(NFSSVC_MAXBLKSIZE_V2); /* max transfer size */ |
467 | *p++ = htonl(stat->f_bsize); | 462 | *p++ = htonl(stat->f_bsize); |
468 | *p++ = htonl(stat->f_blocks); | 463 | *p++ = htonl(stat->f_blocks); |
469 | *p++ = htonl(stat->f_bfree); | 464 | *p++ = htonl(stat->f_bfree); |