shithub: riscv

Download patch

ref: 311e5280279f8d56983df2abae50d545a24ff290
parent: a1a120547768ee33ddaae4ee1965dfcf85149d8a
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Aug 8 19:43:31 EDT 2023

kernel: support 32k iounit

32k iounit increases performance for 9p significantly,
both locally and remotely. This number isn't particularly
important, but it was picked because it's the largest
power of 2 smaller than qiomaxatomic, and because on
slower wifi it does not back things up too much.

--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -16,7 +16,8 @@
  * connection.
  */
 
-#define MAXRPC (IOHDRSZ+8192)
+#define MAXRPC (IOHDRSZ+32768)	/* maximum size of any RPC */
+#define MAXRPC0 (IOHDRSZ+8192)	/* maximum size of Tversion/Rversion pair */
 
 struct Mntrpc
 {
@@ -146,7 +147,7 @@
 	f.tag = NOTAG;
 	f.msize = msize;
 	f.version = v;
-	msg = malloc(8192+IOHDRSZ);
+	msg = malloc(MAXRPC0);
 	if(msg == nil)
 		exhausted("version memory");
 	if(waserror()){
@@ -153,7 +154,7 @@
 		free(msg);
 		nexterror();
 	}
-	k = convS2M(&f, msg, 8192+IOHDRSZ);
+	k = convS2M(&f, msg, MAXRPC0);
 	if(k == 0)
 		error("bad fversion conversion on send");
 
@@ -171,8 +172,8 @@
 	}
 
 	/* message sent; receive and decode reply */
-	for(k = 0; k < BIT32SZ || (k < GBIT32(msg) && k < 8192+IOHDRSZ); k += l){
-		l = devtab[c->type]->read(c, msg+k, 8192+IOHDRSZ-k, c->offset);
+	for(k = 0; k < BIT32SZ || (k < GBIT32(msg) && k < MAXRPC0); k += l){
+		l = devtab[c->type]->read(c, msg+k, MAXRPC0-k, c->offset);
 		if(l <= 0)
 			error("EOF receiving fversion reply");
 		lock(c);