diff options
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/client.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 251abb1699c4..43ec78af4547 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -229,10 +229,23 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag) | |||
229 | return ERR_PTR(-ENOMEM); | 229 | return ERR_PTR(-ENOMEM); |
230 | } | 230 | } |
231 | init_waitqueue_head(req->wq); | 231 | init_waitqueue_head(req->wq); |
232 | req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize, | 232 | if ((c->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) == |
233 | GFP_KERNEL); | 233 | P9_TRANS_PREF_PAYLOAD_SEP) { |
234 | req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize, | 234 | int alloc_msize = min(c->msize, 4096); |
235 | GFP_KERNEL); | 235 | req->tc = kmalloc(sizeof(struct p9_fcall)+alloc_msize, |
236 | GFP_KERNEL); | ||
237 | req->tc->capacity = alloc_msize; | ||
238 | req->rc = kmalloc(sizeof(struct p9_fcall)+alloc_msize, | ||
239 | GFP_KERNEL); | ||
240 | req->rc->capacity = alloc_msize; | ||
241 | } else { | ||
242 | req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize, | ||
243 | GFP_KERNEL); | ||
244 | req->tc->capacity = c->msize; | ||
245 | req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize, | ||
246 | GFP_KERNEL); | ||
247 | req->rc->capacity = c->msize; | ||
248 | } | ||
236 | if ((!req->tc) || (!req->rc)) { | 249 | if ((!req->tc) || (!req->rc)) { |
237 | printk(KERN_ERR "Couldn't grow tag array\n"); | 250 | printk(KERN_ERR "Couldn't grow tag array\n"); |
238 | kfree(req->tc); | 251 | kfree(req->tc); |
@@ -243,9 +256,7 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag) | |||
243 | return ERR_PTR(-ENOMEM); | 256 | return ERR_PTR(-ENOMEM); |
244 | } | 257 | } |
245 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); | 258 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); |
246 | req->tc->capacity = c->msize; | ||
247 | req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall); | 259 | req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall); |
248 | req->rc->capacity = c->msize; | ||
249 | } | 260 | } |
250 | 261 | ||
251 | p9pdu_reset(req->tc); | 262 | p9pdu_reset(req->tc); |