@@ -93,7 +93,10 @@ static int get_protocol_version(const substring_t *name)
}
static struct p9_req_t *
-p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...);
+do_p9_client_rpc(struct p9_client *c, int8_t type, int zc, const char *fmt, ...);
+
+#define p9_client_rpc(client, type, fmt...) do_p9_client_rpc(client, type, 0, ##fmt)
+#define p9_client_zcrpc(client, type, fmt..) do_p9_client_rpc(client, type, 1, ##fmt)
/**
* parse_options - parse mount options into client structure
@@ -583,7 +586,14 @@ 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);
+ if (zc) {
+ 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;
@@ -1348,7 +1358,8 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
req = p9_client_rpc(clnt, P9_TWRITE, "dqD", fid->fid, offset,
rsize, data);
else
- req = p9_client_rpc(clnt, P9_TWRITE, "dqU", fid->fid, offset,
+ /* Try a zero copy rpc for user write */
+ req = p9_client_zcrpc(clnt, P9_TWRITE, "dqU", fid->fid, offset,
rsize, udata);
if (IS_ERR(req)) {
err = PTR_ERR(req);
@@ -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,
};
@@ -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,