code: mafs

Download patch

ref: 436910b0bc02717fbf3c1cce05069cccf25dc7fa
parent: a9b725713342e4c1172a71c13881639b759117d2
author: 9ferno <[email protected]>
date: Sun Nov 27 13:34:53 EST 2022

corrected nmemunits calculation

--- a/mafs.c
+++ b/mafs.c
@@ -76,25 +76,27 @@
 	if(size == 0)
 		panic("null size %s", devfile);
 
-	if(nmemunits == 0)
-		if(size/Blocksize > 8*MiB)
+	if(nmemunits == 0){
+		nmemunits = size/Blocksize;
+		if(nmemunits > 8*MiB)
 			nmemunits = 8*MiB;
-		else if(size/Blocksize < 8*KiB)
+		else if(nmemunits < 8*KiB)
 			nmemunits = 8*KiB;
+	}
+	/* TODO need to do this better */
 	if(nbuckets == 0)
 		nbuckets = nmemunits/(4*Ncollisions*Maxdatablockunits);
-	if(nbuckets == 0)
+	if(nbuckets < 7)
 		nbuckets = 7;
 
-//	if(chatty9p){
+	if(chatty9p){
 		dprint("\nPlan 9 %d-bit file server with %d-deep indirect blocks\n",
 			sizeof(u64)*8, Niblock);
 		dprint("nmemunits %llud nbuckets %llud\n",
 				nmemunits, nbuckets);
-//	}
+	}
 
 	formatinit();
-
 	initmemunitpool(nmemunits);
 	initextents(&frees, "blocks");
 	iobufinit();
--- a/tests/regress.rc
+++ b/tests/regress.rc
@@ -66,9 +66,9 @@
 
 	# start service
 	if(~ $"debug '')
-		disk/^$cmd -r $test -h 10 $disk
+		disk/^$cmd -r $test $disk
 	if not
-		disk/^$cmd $"debug -r $test -h 10 $disk
+		disk/^$cmd $"debug -r $test $disk
 	echo service status: $status
 
 	mount -c /srv/^$test /n/^$service