shithub: gefs

Download patch

ref: e211e19a42770000cf97c3dad712a79b9201aeb8
parent: 88c8be97d8877f0eb8d884a34f8575f1f1948bfa
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 2 12:18:04 EDT 2023

blk: make chainblock async -- no need to block here.

--- a/blk.c
+++ b/blk.c
@@ -249,21 +249,17 @@
 	return lb;
 }
 
-static int
+static void
 chainlog(Blk *pb, Bptr nb)
 {
 	if(pb == nil)
-		return 0;
+		return;
 	assert(pb->type == Tlog);
 	setflag(pb, Bdirty);
 	pb->logp = nb;
 	finalize(pb);
-	if(syncblk(pb) == -1){
-		dropblk(pb);
-		return -1;
-	}
-	dropblk(pb);
-	return 0;
+	enqueue(pb);
+	return;
 }
 
 /*
@@ -311,8 +307,8 @@
 		p = lb->data + lb->logsz;
 		PACK64(p, o|LogAlloc1);
 		lb->logsz += 8;
-		if(chainlog(lb, nl->bp) == -1)
-			return -1;
+		chainlog(lb, nl->bp);
+		dropblk(lb);
 		a->logtl = nl;
 		a->nlog++;
 		lb = nl;
@@ -464,7 +460,6 @@
 			a->nlog++;
 			initblk(nb, blks[i++], -1, Tlog);
 			chainlog(b, nb->bp);
-			enqueue(b);
 			dropblk(b);
 			b = nb;
 		}
@@ -471,6 +466,7 @@
 		p = b->data + b->logsz;
 		PACK64(p+0, r->off|LogFree);
 		PACK64(p+8, r->len);
+		setflag(b, Bdirty);
 		b->logsz += 16;
 	}
 	finalize(b);