code: mafs

Download patch

ref: b5625308080d02ccbdb075997fb5d9e6be1e03fa
parent: 75b53545a7171c0db616b09b953c44c6a8fa6a94
author: 9ferno <gophone2015@gmail.com>
date: Sat Dec 3 21:18:08 EST 2022

reduced the Nrefresh and added notes about optimizing Maxdatablockunits

--- a/dat.h
+++ b/dat.h
@@ -37,7 +37,7 @@
 	Usec	= 1000ULL*1000,
 	Msec	= 1000ULL,
 	Nbkp	= 1,
-	Nrefresh = 10*Nsec,
+	Nrefresh = 3*Nsec,
 };
 
 /*
--- a/docs/mafs.ms
+++ b/docs/mafs.ms
@@ -642,7 +642,7 @@
 Mafs needs atleast Nminblocks=28 blocks (14 KiB).
 .fi
 .sp
-kfs and cwfs use 8192 byte blocks. Hence, they store multiple directory entries (Dentry) per block. They use slot numbers to identify a particular directory entry in a block of directory entries. Mafs avoids that be using 512 byte blocks thus having only one directory entry per block. This avoids locking up other sibling directory entries on access.
+kfs and cwfs use 8192 byte blocks. Hence, they store multiple directory entries (Dentry) per block. They use slot numbers to identify a particular directory entry in a block of directory entries. Mafs avoids that by using 512 byte blocks thus having only one directory entry per block. This avoids locking up other sibling directory entries on access and better throughput for large files but also slows down walk()'s as mafs would be using a read() per directory entry.
 .sp
 .sp
 .ne 4
@@ -739,9 +739,13 @@
 arrow dashed from Iobufn2.ne - 0.05i,0 to Iobuf2.se - 0.05i,0
 .PE
 .sp
-The size of the buffer cache is: number of hash buckets * collisions per hash bucket * block size. The approximate size of the buffer cache = Nbuckets * Ncollisions * Rawblocksize = 256 * 10 * 512 bytes = 1.28GiB. The -h parameter can be used to change the number of hash buckets.
+The size of the buffer cache is: number of hash buckets * collisions per hash bucket * block size. The approximate size of the buffer cache is Nbuckets * Ncollisions * Blocksize * Maxdatablockunits.
 .sp
+When there is an ups, the ideal memnunits (-m) is disk throughput * Nrefresh * ups duration/2. Without an ups, Without an ups, disk throughput * Nrefresh * 3 seems optimal.
+.sp
 If you have RAM to spare, increase Nbuckets instead of Ncollisions as the hash index lookup is faster than searching through a linked list.
+.sp
+Using Maxdatablockunits of 2048 allows bigger data blocks thus providing better throughput for large files but also wastes a lot more memory while writing to small files. If your use case involves requiring more efficient use of memory, setting Maxdatablockunits to 16 keeps the data block sizes down to what cwfs uses.
 .sp
 Iobuf.Ref is used to avoid locking up the hash bucket when a process is waiting for a lock on an Iobuf in that hash bucket.
 .sp