shithub: gefs

Download patch

ref: 8699acdfd9cc2257cf4dded4b30da401bf8c4e68
parent: 8f5dce402748eb7b3e40674c1cd5b25b1bd5b4e5
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Mar 6 15:16:32 EST 2022

dump: remove unused showpath, clean up headers.

--- a/dat.h
+++ b/dat.h
@@ -10,7 +10,6 @@
 typedef struct Xdir	Xdir;
 typedef struct Bptr	Bptr;
 typedef struct Bfree	Bfree;
-typedef struct Path	Path;
 typedef struct Scan	Scan;
 typedef struct Dent	Dent;
 typedef struct Scanp	Scanp;
@@ -542,25 +541,6 @@
 	POrot,
 	POsplit,
 	POmerge,
-};
-
-struct Path {
-	/* Flowing down for flush */
-	Msg	*ins;	/* inserted values, bounded by lo..hi */
-	Blk	*b;	/* to shadow */
-	int	idx;	/* insert at */
-	int	lo;	/* key range */
-	int	hi;	/* key range */
-	int	sz;	/* size of range */
-
-	/* Flowing up from flush */
-	int	op;	/* change done along path */
-	Blk	*m;	/* node merged against, for post-update free */
-	Blk	*nl;	/* new left */
-	Blk	*nr;	/* new right, if we split or rotated */
-	int	midx;	/* modification index */
-	int	npull;	/* number of messages successfully pulled */
-	int	pullsz;	/* size of pulled messages */
 };
 
 struct Scanp {
--- a/dump.c
+++ b/dump.c
@@ -411,37 +411,6 @@
 }
 
 void
-showpath(int fd, Path *p, int np)
-{
-#define A(b) (b ? b->bp.addr : -1)
-	int i;
-	char *op[] = {
-	[POmod] = "POmod",
-	[POrot] = "POrot",
-	[POsplit] = "POsplit",
-	[POmerge] = "POmerge",
-	};
-
-	fprint(fd, "path:\n");
-	for(i = 0; i < np; i++){
-		fprint(fd, "\t[%d] ==>\n"
-			"\t\t%s: b(%p)=%llx [%s]\n"
-			"\t\tnl(%p)=%llx, nr(%p)=%llx\n"
-			"\t\tidx=%d, midx=%d\n"
-			"\t\tpullsz=%d, npull=%d, \n"
-			"\t\tclear=(%d. %d)\n",
-			i, op[p[i].op],
-			p[i].b, A(p[i].b), (p[i].b == nil) ? "nil" : (p[i].b->type == Tleaf ? "leaf" : "pivot"),
-			p[i].nl, A(p[i].nl),
-			p[i].nr, A(p[i].nr),
-			p[i].idx, p[i].midx,
-			p[i].pullsz, p[i].npull,
-			p[i].lo, p[i].hi);
-	}
-#undef A
-}
-
-void
 showfree(int fd, char **, int)
 {
 	Arange *r;
--- a/fns.h
+++ b/fns.h
@@ -79,7 +79,6 @@
 void	initshow(void);
 void	showblk(int, Blk*, char*, int);
 void	showbp(int, Bptr, int);
-void	showpath(int, Path*, int);
 void	showtreeroot(int, Tree*);
 void	showtree(int, char**, int);
 void	showsnap(int, char**, int);
--- a/tree.c
+++ b/tree.c
@@ -6,6 +6,27 @@
 #include "dat.h"
 #include "fns.h"
 
+typedef struct Path	Path;
+
+struct Path {
+	/* Flowing down for flush */
+	Msg	*ins;	/* inserted values, bounded by lo..hi */
+	Blk	*b;	/* to shadow */
+	int	idx;	/* insert at */
+	int	lo;	/* key range */
+	int	hi;	/* key range */
+	int	sz;	/* size of range */
+
+	/* Flowing up from flush */
+	int	op;	/* change done along path */
+	Blk	*m;	/* node merged against, for post-update free */
+	Blk	*nl;	/* new left */
+	Blk	*nr;	/* new right, if we split or rotated */
+	int	midx;	/* modification index */
+	int	npull;	/* number of messages successfully pulled */
+	int	pullsz;	/* size of pulled messages */
+};
+
 static void
 stablesort(Msg *m, int nm)
 {