diff mbox

[V9fs-developer,4/7,net/9p] Add gup/zero_copy support to VirtIO transport layer.

Message ID 8739nyj4rt.fsf@linux.vnet.ibm.com (mailing list archive)
State Accepted, archived
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

Aneesh Kumar K.V Feb. 8, 2011, 8:43 a.m. UTC
None
diff mbox

Patch

diff --git a/net/9p/client.c b/net/9p/client.c
index a05673b..a6164ff 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -583,7 +583,15 @@  p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
 		goto reterr;
 	p9pdu_finalize(req->tc);
 
-	err = c->trans_mod->request(c, req);
+	/* try to zero copy request for few of the operations */
+	if (zero_copy(request)) {
+		err = c->trans_mode->zc_request(c, req);
+		if (err == EAGAIN) {
+			err = c->trans_mode->request(c, req);
+		}
+
+	} else
+		err = c->trans_mod->request(c, req);
 	if (err < 0) {
 		if (err != -ERESTARTSYS)
 			c->status = Disconnected;
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 078eb16..91b5a47 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -1012,6 +1012,7 @@  static struct p9_trans_module p9_tcp_trans = {
 	.create = p9_fd_create_tcp,
 	.close = p9_fd_close,
 	.request = p9_fd_request,
+	.zc_request = p9_no_zero_copy_request,
 	.cancel = p9_fd_cancel,
 	.owner = THIS_MODULE,
 };
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index c8f3f72..576da62 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -446,6 +446,7 @@  static struct p9_trans_module p9_virtio_trans = {
 	.create = p9_virtio_create,
 	.close = p9_virtio_close,
 	.request = p9_virtio_request,
+	.zc_request = p9_virtio_zero_copy_request,
 	.cancel = p9_virtio_cancel,
 	.maxsize = PAGE_SIZE*16,
 	.def = 0,