ref: 05dc356d2fb9d72405b0b2d0b36505f729d8591c
parent: b9b1f6c7c09d3294512caf822792ea268cd8a28a
author: cinap_lenrek <[email protected]>
date: Sat Aug 19 22:28:50 EDT 2023
use 32k IOUNIT for 9p
--- a/exportfs/exportfs.c
+++ b/exportfs/exportfs.c
@@ -56,7 +56,7 @@
messagesize = iounit(netfd);
if(messagesize == 0)
- messagesize = 8192+IOHDRSZ;
+ messagesize = IOUNIT+IOHDRSZ;
Workq = emallocz(sizeof(Fsrpc)*Nr_workbufs);
// for(i=0; i<Nr_workbufs; i++)
--- a/include/lib.h
+++ b/include/lib.h
@@ -109,6 +109,7 @@
#define ERRMAX 128 /* max length of error string */
#define KNAMELEN 28 /* max length of name held in kernel */
+#define IOUNIT 32768 /* default buffer size for 9p io */
/* bits in Qid.type */
#define QTDIR 0x80 /* type bit for directories */
--- a/kern/devmnt.c
+++ b/kern/devmnt.c
@@ -15,7 +15,8 @@
* connection.
*/
-#define MAXRPC (IOHDRSZ+8192)
+#define MAXRPC (IOHDRSZ+32768)
+#define MAXRPC0 (IOHDRSZ+8192) /* maximum size of Tversion/Rversion pair */
struct Mntrpc
{
@@ -140,7 +141,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()){
@@ -147,7 +148,7 @@
free(msg);
nexterror();
}
- k = convS2M(&f, msg, 8192+IOHDRSZ);
+ k = convS2M(&f, msg, MAXRPC0);
if(k == 0)
error("bad fversion conversion on send");
@@ -165,8 +166,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->ref.lk);
--- a/kern/devtls.c
+++ b/kern/devtls.c
@@ -482,7 +482,17 @@
c->mode = openmode(omode);
c->flag |= COPEN;
c->offset = 0;
- c->iounit = MaxRecLen;
+ switch(t){
+ case Qdata:
+ c->iounit = qiomaxatomic;
+ break;
+ case Qhand:
+ c->iounit = MaxRecLen;
+ break;
+ default:
+ c->iounit = 0;
+ break;
+ }
return c;
}
@@ -1344,6 +1354,8 @@
if(waserror()){
if(strcmp(up->errstr, "interrupted") != 0)
tlsError(tr, "channel error");
+ else if(bb != nil)
+ continue;
nexterror();
}
devtab[tr->c->type]->bwrite(tr->c, nb, 0);
@@ -1590,6 +1602,7 @@
b->wp += m;
tlsbwrite(c, b, offset);
+ offset += m;
p += m;
}while(p < e);