aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
authorVenkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>2011-02-16 21:43:20 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:35 -0400
commit2c66523fd290edeea26cbe8cedd0af167d0f7e5f (patch)
treee2658302dfce599cd42545d0487a5650a187c7bd /net/9p
parent1fc52481c2b886c445bb167dfd16ee6de6922ef7 (diff)
[net/9p] readdir zerocopy changes for 9P2000.L protocol.
Modify p9_client_readdir() to check the transport preference and act according If the preference is P9_TRANS_PREF_PAYLOAD_SEP, send the payload separately instead of putting it directly on PDU. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/client.c11
-rw-r--r--net/9p/protocol.c18
2 files changed, 27 insertions, 2 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 412c52e1de74..6e07ef494ff2 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1735,7 +1735,14 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
1735 if (count < rsize) 1735 if (count < rsize)
1736 rsize = count; 1736 rsize = count;
1737 1737
1738 req = p9_client_rpc(clnt, P9_TREADDIR, "dqd", fid->fid, offset, rsize); 1738 if ((clnt->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) ==
1739 P9_TRANS_PREF_PAYLOAD_SEP) {
1740 req = p9_client_rpc(clnt, P9_TREADDIR, "dqF", fid->fid,
1741 offset, rsize, data);
1742 } else {
1743 req = p9_client_rpc(clnt, P9_TREADDIR, "dqd", fid->fid,
1744 offset, rsize);
1745 }
1739 if (IS_ERR(req)) { 1746 if (IS_ERR(req)) {
1740 err = PTR_ERR(req); 1747 err = PTR_ERR(req);
1741 goto error; 1748 goto error;
@@ -1749,7 +1756,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
1749 1756
1750 P9_DPRINTK(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count); 1757 P9_DPRINTK(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count);
1751 1758
1752 if (data) 1759 if (!req->tc->pbuf_size && data)
1753 memmove(data, dataptr, count); 1760 memmove(data, dataptr, count);
1754 1761
1755 p9_free_req(clnt, req); 1762 p9_free_req(clnt, req);
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 7bca2421bfc8..2ce515b859b3 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -125,6 +125,15 @@ pdu_write_urw(struct p9_fcall *pdu, const char *kdata, const char __user *udata,
125 return 0; 125 return 0;
126} 126}
127 127
128static size_t
129pdu_write_readdir(struct p9_fcall *pdu, const char *kdata, size_t size)
130{
131 BUG_ON(pdu->size > P9_READDIRHDRSZ);
132 pdu->pkbuf = (char *)kdata;
133 pdu->pbuf_size = size;
134 return 0;
135}
136
128/* 137/*
129 b - int8_t 138 b - int8_t
130 w - int16_t 139 w - int16_t
@@ -466,6 +475,15 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
466 errcode = -EFAULT; 475 errcode = -EFAULT;
467 } 476 }
468 break; 477 break;
478 case 'F':{
479 int32_t cnt = va_arg(ap, int32_t);
480 const char *k = va_arg(ap, const void *);
481 errcode = p9pdu_writef(pdu, proto_version, "d",
482 cnt);
483 if (!errcode && pdu_write_readdir(pdu, k, cnt))
484 errcode = -EFAULT;
485 }
486 break;
469 case 'U':{ 487 case 'U':{
470 int32_t count = va_arg(ap, int32_t); 488 int32_t count = va_arg(ap, int32_t);
471 const char __user *udata = 489 const char __user *udata =