shithub: gefs

Download patch

ref: 62391489c0ccd5bb01a860b50523eb99905241d1
parent: e890a999ee2142ff650df78730bff516d347ec66
author: Ori Bernstein <[email protected]>
date: Tue Jan 2 10:19:01 EST 2024

fs: ntrace, not tracesz -- makes for better reading.

--- a/cons.c
+++ b/cons.c
@@ -311,8 +311,8 @@
 		fprint(fd, "error opening output");
 		return;
 	}
-	for(i = 0; i < fs->tracesz; i++){
-		t = &fs->trace[(fs->traceidx + i) % fs->tracesz];
+	for(i = 0; i < fs->ntrace; i++){
+		t = &fs->trace[(fs->traceidx + i) % fs->ntrace];
 		if(t->msg[0] == 0)
 			continue;
 		Bprint(bfd, "[%d@%d] %s", t->tid, t->qgen, t->msg);
@@ -350,8 +350,9 @@
 		"permit [on|off] -- switch to/from permissive mode\n"
 		"reserve [on|off] -- enable block reserves\n"
 		"snap -[Smdl] [old [new]] -- manage snapshots\n"
-		"sync --flush all pending writes to disk\n"
+		"sync -- flush all pending writes to disk\n"
 		"users -- reload user table from adm snapshot\n"
+		"save trace [name] -- save a trace of recent activity\n"
 		"show -- debug dumps\n"
 		"	tree [name]\n"
 		"	fid\n"
--- a/dat.h
+++ b/dat.h
@@ -576,7 +576,7 @@
 
 	Trace	*trace;
 	long	traceidx;
-	long	tracesz;
+	long	ntrace;
 };
 
 struct Arena {
--- a/main.c
+++ b/main.c
@@ -36,7 +36,7 @@
 	ulong idx;
 
 	idx = aincl(&fs->traceidx, 1);
-	t = &fs->trace[(idx-1) & ~(fs->tracesz-1)];
+	t = &fs->trace[(idx-1) % fs->ntrace];
 	strecpy(t->msg, t->msg+sizeof(t->msg), msg);
 	t->tid = (*errctx)->tid;
 	t->qgen = agetv(&fs->qgen);
@@ -162,7 +162,7 @@
 
 	if(tracesz != 0){
 		fs->trace = emalloc(tracesz, 1);
-		fs->tracesz = tracesz/sizeof(Trace);
+		fs->ntrace = tracesz/sizeof(Trace);
 	}
 	fs->lrurz.l = &fs->lrulk;
 	fs->syncrz.l = &fs->synclk;
--- a/snap.c
+++ b/snap.c
@@ -190,6 +190,7 @@
 	}
 	d = getdl(merge, bgen);
 	m = getdl(gen, bgen);
+	assert(d != m);
 	/*
 	 * If the dest dlist didn't exist,
 	 * just move the merge dlist over
@@ -212,6 +213,7 @@
 		}
 		b = getblk(d->tl, 0);
 		b->logp = m->hd;
+		assert(d->hd.addr != m->hd.addr);
 		finalize(b);
 		syncblk(b);
 		dropblk(b);