mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
[net/9p] Small non-IO PDUs for zero-copy supporting transports.
If a transport prefers payload to be sent separate from the PDU (P9_TRANS_PREF_PAYLOAD_SEP), there is no need to allocate msize PDU buffers(struct p9_fcall). This patch allocates only upto 4k buffers for this kind of transports and there won't be any change to the legacy transports. Hence, this patch on top of zero copy changes allows user to specify higher msizes through the mount option without hogging the kernel heap. Signed-off-by: Venkateswararao Jujjuri <[email protected]> Signed-off-by: Eric Van Hensbergen <[email protected]>
This commit is contained in:
parent
ca41bb3e21
commit
f735195d51
2 changed files with 18 additions and 7 deletions
|
|
@ -229,10 +229,23 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
|
|||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
init_waitqueue_head(req->wq);
|
||||
req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
|
||||
GFP_KERNEL);
|
||||
req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
|
||||
GFP_KERNEL);
|
||||
if ((c->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) ==
|
||||
P9_TRANS_PREF_PAYLOAD_SEP) {
|
||||
int alloc_msize = min(c->msize, 4096);
|
||||
req->tc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
|
||||
GFP_KERNEL);
|
||||
req->tc->capacity = alloc_msize;
|
||||
req->rc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
|
||||
GFP_KERNEL);
|
||||
req->rc->capacity = alloc_msize;
|
||||
} else {
|
||||
req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
|
||||
GFP_KERNEL);
|
||||
req->tc->capacity = c->msize;
|
||||
req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
|
||||
GFP_KERNEL);
|
||||
req->rc->capacity = c->msize;
|
||||
}
|
||||
if ((!req->tc) || (!req->rc)) {
|
||||
printk(KERN_ERR "Couldn't grow tag array\n");
|
||||
kfree(req->tc);
|
||||
|
|
@ -243,9 +256,7 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
|
|||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall);
|
||||
req->tc->capacity = c->msize;
|
||||
req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall);
|
||||
req->rc->capacity = c->msize;
|
||||
}
|
||||
|
||||
p9pdu_reset(req->tc);
|
||||
|
|
|
|||
Loading…
Reference in a new issue