Skip to content

Commit 8e4c2ee

Browse files
cschoenebeckmartinetd
authored andcommitted
net/9p: distinguish zero-copy requests
Add boolean `zc` member to struct p9_fcall to distinguish zero-copy messages (not using the linear `sdata` buffer for message payload) from regular messages (which do copy message payload to `sdata` before being further processed). This new member is appended to end of structure to avoid inserting huge padding in generated layout. Link: https://lkml.kernel.org/r/8f2a5c12a446c3b544da64e0b1550e1fb2d6f972.1669144861.git.linux_oss@crudebyte.com Signed-off-by: Christian Schoenebeck <[email protected]> Tested-by: Stefano Stabellini <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent f15e006 commit 8e4c2ee

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/net/9p/9p.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ struct p9_rstatfs {
531531
* @offset: used by marshalling routines to track current position in buffer
532532
* @capacity: used by marshalling routines to track total malloc'd capacity
533533
* @sdata: payload
534+
* @zc: whether zero-copy is used
534535
*
535536
* &p9_fcall represents the structure for all 9P RPC
536537
* transactions. Requests are packaged into fcalls, and reponses
@@ -549,6 +550,7 @@ struct p9_fcall {
549550

550551
struct kmem_cache *cache;
551552
u8 *sdata;
553+
bool zc;
552554
};
553555

554556
int p9_errstr2errno(char *errstr, int len);

net/9p/client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
685685
if (IS_ERR(req))
686686
return req;
687687

688+
req->tc.zc = false;
689+
req->rc.zc = false;
690+
688691
if (signal_pending(current)) {
689692
sigpending = 1;
690693
clear_thread_flag(TIF_SIGPENDING);
@@ -783,6 +786,9 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
783786
if (IS_ERR(req))
784787
return req;
785788

789+
req->tc.zc = true;
790+
req->rc.zc = true;
791+
786792
if (signal_pending(current)) {
787793
sigpending = 1;
788794
clear_thread_flag(TIF_SIGPENDING);

0 commit comments

Comments
 (0)