shithub: gefs

Download patch

ref: 5957ad359bc5e536af25a9743e3d87376e523744
parent: 6d1b981e9e224d70fd474aa070046d20238f6215
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Dec 6 13:45:55 EST 2023

revert 3c5258b1c6d5c81cc13e1236af6ab3f35d0661f9

--- a/ream.c
+++ b/ream.c
@@ -173,10 +173,6 @@
 		asz -= Blksz;
 	}
 	addr = start+Blksz;	/* leave room for arena hdr */
-	if(addr == 512*MiB){
-		addr += Blksz;
-		asz -= Blksz;
-	}
 
 	a->loghd.addr = -1;
 	a->loghd.hash = -1;
@@ -185,6 +181,10 @@
 	memset(b->buf, 0, sizeof(b->buf));
 	b->type = Tlog;
 	b->bp.addr = addr+Blksz;
+	if(b->bp.addr == 512*MiB){
+		b->bp.addr += Blksz;
+		asz -= Blksz;
+	}
 	b->logsz = 0;
 	b->logp = (Bptr){-1, -1, -1};
 	b->data = b->buf + Loghdsz;
@@ -268,18 +268,19 @@
 	adm = mallocz(sizeof(Mount), 1);
 	adm->root = mallocz(sizeof(Tree), 1);
 
-	sz = sz - sz%Blksz;
-	fs->narena = (sz + 4096ULL*GiB - 1) / (4096ULL*GiB);
-	if(fs->narena < 4)
-		fs->narena = 4;
-	if(fs->narena >= 32)
-		fs->narena = 32;
+	sz = sz - sz%Blksz - 2*Blksz;
+
+	fs->narena = (sz + 64ULL*GiB - 1) / (64ULL*GiB);
+	if(fs->narena < 8)
+		fs->narena = 8;
+	if(fs->narena >= 128)
+		fs->narena = 128;
 	fs->arenas = emalloc(fs->narena*sizeof(Arena), 1);
 
 
 	off = Blksz;
 	asz = sz/fs->narena;
-	asz = asz - (asz % Blksz) - 2*Blksz;
+	asz = asz - (asz % Blksz) - Blksz;
 	fs->arenasz = asz;
 
 	sb0 = cachepluck();
@@ -293,8 +294,7 @@
 		print("\tarena %d: %lld blocks at %llx\n", i, asz/Blksz, off);
 		initarena(a, off, asz);
 		fs->arenabp[i] = a->hd->bp;
-		off += asz+2*Blksz;
-
+		off += asz+Blksz;
 	}
 	
 	for(i = 0; i < fs->narena; i++){