ref: 4d8019c4f7efa8548d743bbbb907f58c67203daf
parent: 1a095e29962ecc6a73ccf2b7e36c1373ff3e7b9f
author: 9ferno <[email protected]>
date: Mon Nov 28 22:49:07 EST 2022
the minimum number of memunits is a multiple of Ncollisions and the minimum number of hash buckets
--- a/mafs.c
+++ b/mafs.c
@@ -18,7 +18,7 @@
static void
usage(void)
{
- fprint(2, "usage: mafs [-Ds] [-r service] [-n service] [-m nmemunits] [-h nbuckets] file\n");
+ fprint(2, "usage: mafs [-Ds] [-r service] [-n service] [-m nmemunits] file\n");
exits("usage");
}
@@ -51,7 +51,6 @@
default: usage();
case 'D': chatty9p++; break;
case 'f': devfile = ARGF(); break;
- case 'h': nbuckets = atoll(EARGF(usage())); break;
case 'm': nmemunits = atoll(EARGF(usage())); break;
case 'r':
doream = 1;
@@ -76,16 +75,19 @@
if(size == 0)
panic("null size %s", devfile);
+ /*
+ Minimum number of collisions = 3
+ Minimum number of hash buckets = 7
+ Minimum number of memunits = 7 * 3 * 2048 blocks = 43,008 blocks
+ */
if(nmemunits == 0){
nmemunits = size/Blocksize;
if(nmemunits > 8*MiB)
nmemunits = 8*MiB;
- else if(nmemunits < 8*KiB)
- nmemunits = 8*KiB;
+ else if(nmemunits < 42*KiB)
+ nmemunits = 42*KiB;
}
- /* TODO need to do this better */
- if(nbuckets == 0)
- nbuckets = nmemunits/(4*Ncollisions*Maxdatablockunits);
+ nbuckets = nmemunits/(4*Ncollisions*Maxdatablockunits);
if(nbuckets < 7)
nbuckets = 7;