[PATCH 1/2] net/9p: distinguish zero-copy requests

From: Christian Schoenebeck
Date: Mon Nov 21 2022 - 18:56:43 EST


Signed-off-by: Christian Schoenebeck <linux_oss@xxxxxxxxxxxxx>
---
include/net/9p/9p.h | 2 ++
net/9p/client.c | 4 ++++
2 files changed, 6 insertions(+)

diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 13abe013af21..b0a6dec20b92 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -530,6 +530,7 @@ struct p9_rstatfs {
* @tag: transaction id of the request
* @offset: used by marshalling routines to track current position in buffer
* @capacity: used by marshalling routines to track total malloc'd capacity
+ * @zc: whether zero-copy is used
* @sdata: payload
*
* &p9_fcall represents the structure for all 9P RPC
@@ -546,6 +547,7 @@ struct p9_fcall {

size_t offset;
size_t capacity;
+ bool zc;

struct kmem_cache *cache;
u8 *sdata;
diff --git a/net/9p/client.c b/net/9p/client.c
index aaa37b07e30a..30dd82f49b28 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -680,6 +680,8 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
if (IS_ERR(req))
return req;

+ req->tc.zc = req->rc.zc = false;
+
if (signal_pending(current)) {
sigpending = 1;
clear_thread_flag(TIF_SIGPENDING);
@@ -778,6 +780,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
if (IS_ERR(req))
return req;

+ req->tc.zc = req->rc.zc = true;
+
if (signal_pending(current)) {
sigpending = 1;
clear_thread_flag(TIF_SIGPENDING);
--
2.30.2