code: mafs

Download patch

ref: e6ed176a5366eb410de4c9a126a2cc540de0f0db
parent: 4210fbecf4d94bd5873037bc3f5c721f47f42a2c
author: 9ferno <gophone2015@gmail.com>
date: Fri Nov 25 22:42:29 EST 2022

fixed bug in sync crash

--- a/dat.h
+++ b/dat.h
@@ -37,7 +37,7 @@
 	Usec	= 1000ULL*1000,
 	Msec	= 1000ULL,
 	Nbkp	= 1,
-	Nrefresh = 10*Nsec,
+	Nrefresh = 3*Nsec,
 };
 
 /*
--- a/dentry.c
+++ b/dentry.c
@@ -17,9 +17,6 @@
 	b->new->verd++;
 	writeallappend(b, b->new, b->blkno);
 	putbuf(b, 1);
-	freememunits(b->append, Maxdatablockunits);
-	b->append = nil;
-	b->appendsize = 0;
 	return 1;
 }
 
--- a/iobuf.c
+++ b/iobuf.c
@@ -108,6 +108,7 @@
 	u64 nlocked, i;
 
 	nlocked = 0;
+Again:
 	for(i = 0; i < nbuckets; i++){
 		hp=&hiob[i];
 		qlock(hp);
@@ -120,7 +121,7 @@
 							qunlock(hp);
 							if(flush(p) == 0)
 								wunlock(p);
-							qlock(hp);
+							goto Again;
 						}else{
 							// cannot be sure about this without a lock
 							// if(p->xiobuf[0] == Tdentry)
--- a/mafs.c
+++ b/mafs.c
@@ -80,7 +80,7 @@
 		and 1/3rd for the buffer cache
 	 */
 	if(nmemunits == 0)
-		nmemunits = size/Blocksize > 1*MiB ? 1*MiB : size/Blocksize;
+		nmemunits = size/Blocksize > 500*KiB ? 500*KiB : size/Blocksize;
 	if(nbuckets == 0)
 		nbuckets = nmemunits/(4*Ncollisions*Maxdatablockunits);
 	if(nbuckets == 0)