aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsxdr.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-04 05:15:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:15 -0400
commit3cc03b164cf01c6f36e64720b58610d292fb26f7 (patch)
treeb558e11a087945ad5b9a1a25483aa2acc8d93fbb /fs/nfsd/nfsxdr.c
parent4452435948424e5322c2a2fefbdc2cf3732cc45d (diff)
[PATCH] knfsd: Avoid excess stack usage in svc_tcp_recvfrom
.. by allocating the array of 'kvec' in 'struct svc_rqst'. As we plan to increase RPCSVC_MAXPAGES from 8 upto 256, we can no longer allocate an array of this size on the stack. So we allocate it in 'struct svc_rqst'. However svc_rqst contains (indirectly) an array of the same type and size (actually several, but they are in a union). So rather than waste space, we move those arrays out of the separately allocated union and into svc_rqst to share with the kvec moved out of svc_tcp_recvfrom (various arrays are used at different times, so there is no conflict). Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfsxdr.c')
-rw-r--r--fs/nfsd/nfsxdr.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index ad2fba3c54f8..ab6745e78d16 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -263,9 +263,9 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
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 args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]); 266 rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_respages[pn]);
267 args->vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE; 267 rqstp->rq_vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE;
268 len -= args->vec[v].iov_len; 268 len -= rqstp->rq_vec[v].iov_len;
269 v++; 269 v++;
270 } 270 }
271 args->vlen = v; 271 args->vlen = v;
@@ -285,21 +285,21 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
285 args->offset = ntohl(*p++); /* offset */ 285 args->offset = ntohl(*p++); /* offset */
286 p++; /* totalcount */ 286 p++; /* totalcount */
287 len = args->len = ntohl(*p++); 287 len = args->len = ntohl(*p++);
288 args->vec[0].iov_base = (void*)p; 288 rqstp->rq_vec[0].iov_base = (void*)p;
289 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 -
290 (((void*)p) - rqstp->rq_arg.head[0].iov_base); 290 (((void*)p) - rqstp->rq_arg.head[0].iov_base);
291 if (len > NFSSVC_MAXBLKSIZE) 291 if (len > NFSSVC_MAXBLKSIZE)
292 len = NFSSVC_MAXBLKSIZE; 292 len = NFSSVC_MAXBLKSIZE;
293 v = 0; 293 v = 0;
294 while (len > args->vec[v].iov_len) { 294 while (len > rqstp->rq_vec[v].iov_len) {
295 len -= args->vec[v].iov_len; 295 len -= rqstp->rq_vec[v].iov_len;
296 v++; 296 v++;
297 args->vec[v].iov_base = page_address(rqstp->rq_pages[v]); 297 rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]);
298 args->vec[v].iov_len = PAGE_SIZE; 298 rqstp->rq_vec[v].iov_len = PAGE_SIZE;
299 } 299 }
300 args->vec[v].iov_len = len; 300 rqstp->rq_vec[v].iov_len = len;
301 args->vlen = v+1; 301 args->vlen = v+1;
302 return args->vec[0].iov_len > 0; 302 return rqstp->rq_vec[0].iov_len > 0;
303} 303}
304 304
305int 305int