shithub: gefs

Download patch

ref: 7b5664be2c9015c07facb5cd49685efc16887ac1
parent: 4714988ecac57b015fc0c93c65b3c8e3ab25600c
author: Ori Bernstein <[email protected]>
date: Thu Nov 2 00:51:15 EDT 2023

gefs: remove junk superblock stuff

--- a/dat.h
+++ b/dat.h
@@ -13,7 +13,6 @@
 typedef struct Scan	Scan;
 typedef struct Dent	Dent;
 typedef struct Scanp	Scanp;
-typedef struct Fshdr	Fshdr;
 typedef struct Arena	Arena;
 typedef struct Arange	Arange;
 typedef struct Bucket	Bucket;
@@ -457,7 +456,11 @@
 	vlong	cachelook;
 };
 
-struct Fshdr {
+/*
+ * Overall state of the file sytem.
+ * Shadows the superblock contents.
+ */
+struct Gefs {
 	int	blksz;
 	int	bufspc;
 	Tree	snap;
@@ -468,14 +471,7 @@
 	vlong	nextgen;
 	vlong	qgen;
 	Bptr	*arenabp;
-};
 
-/*
- * Overall state of the file sytem.
- * Shadows the superblock contents.
- */
-struct Gefs {
-	Fshdr;
 	/* superblocks */
 	Blk	*sb0;	/* primary */
 	Blk	*sb1;	/* backup */
@@ -502,7 +498,7 @@
 	Chan	**rdchan;
 
 	QLock	mutlk;
-	int	nworker;
+	long	nworker;
 	long	epoch;
 	long	lepoch[32];
 	Bfree	*limbo[3];
--- a/fns.h
+++ b/fns.h
@@ -156,13 +156,13 @@
 char*	packsnap(char*, int, vlong);
 char*	packsuper(char*, int, vlong);
 char*	packtree(char*, int, Tree*);
-char*	packsb(char*, int, Fshdr*);
+char*	packsb(char*, int, Gefs*);
 
 char*	unpackarena(Arena*, char*, int);
 Bptr	unpackbp(char*, int);
 char*	unpackdkey(char*, int, vlong*);
 Tree*	unpacktree(Tree*, char*, int);
-char*	unpacksb(Fshdr*, char*, int);
+char*	unpacksb(Gefs*, char*, int);
 
 /* void* is a bit hacky, but we want both signed and unsigned to work */
 char*	unpack8(int*, char*, char*, void*);
--- a/load.c
+++ b/load.c
@@ -82,8 +82,6 @@
 		sysfatal("superblock: %r\n");
 	if(unpacksb(fs, fs->sb0->buf, Blksz) == nil)
 		sysfatal("superblock: %r");
-	if(unpacksb(fs, fs->sb0->buf, Blksz) == nil)
-		sysfatal("superblock: %r");
 	if((fs->arenas = calloc(fs->narena, sizeof(Arena))) == nil)
 		sysfatal("malloc: %r");
 	for(i = 0; i < fs->narena; i++){
--- a/pack.c
+++ b/pack.c
@@ -556,7 +556,7 @@
 }
 
 char*
-packsb(char *p, int sz, Fshdr *fi)
+packsb(char *p, int sz, Gefs *fi)
 {
 	int i;
 
@@ -584,7 +584,7 @@
 }
 
 char*
-unpacksb(Fshdr *fi, char *p, int sz)
+unpacksb(Gefs *fi, char *p, int sz)
 {
 	int i;