code: mafs

Download patch

ref: 72614a53c48950b8100c4fbe5b693fac53e912e5
parent: c985562065363cb59497579c4c89e283883f5a45
author: 9ferno <gophone2015@gmail.com>
date: Sun Oct 23 04:03:47 EDT 2022

more comments and also identify dirty blocks

--- a/all.h
+++ b/all.h
@@ -16,7 +16,7 @@
 struct Hiob		/* Hash bucket */
 {
 	Iobuf*	link;	/* least recently used of the circular list */
-	QLock;
+	QLock;		/* controls access to this hash bucket */
 };
 
 /*
@@ -53,7 +53,7 @@
 struct Iobuf
 {
 	Ref;
-	RWLock;		/* controls access to this Iobuf */
+	RWLock;			/* controls access to this Iobuf */
 	u64	blkno;		/* block number on the disk, primary key */
 	Iobuf	*fore;	/* for lru */
 	Iobuf	*back;	/* for lru */
--- a/blk.c
+++ b/blk.c
@@ -73,7 +73,7 @@
 
 	t = (Tag*)buf;
 	if(t->type < Maxtind)
-		fprint(fd, "%s %llud\n", tagnames[t->type], t->path);
+		fprint(fd, "%s %llud%s\n", tagnames[t->type], t->path, t->dirty?" dirty":"");
 	if(t->type == Tdentry){
 		showdentry(fd, buf+sizeof(Tag));
 	}else if(t->path == Qpmagic){
--- a/docs/mafs.ms
+++ b/docs/mafs.ms
@@ -492,11 +492,16 @@
 	box height fieldht invis "gid -1"
 	box height fieldht invis "muid 10006"
 	box height fieldht invis "direct blocks"
-	box height fieldht invis "        0 28 2048"
-	box height fieldht invis "        1 2076 1969"
-	box height fieldht invis "        2 0 0"
+	box height fieldht invis "        0 28"
+	box height fieldht invis "        1 29"
+	box height fieldht invis "        2 30"
 	box height fieldht invis "."
 	box height fieldht invis "."
+	box height fieldht invis "indirect blocks"
+	box height fieldht invis "       0 61"
+	box height fieldht invis "       1 124"
+	box height fieldht invis "       2 4031"
+	box height fieldht invis "       3 0"
 	box height fieldht invis "name 2MB.file"
 	"Block 27 contents" at Bound.nw + 0,0.1i ljust
 	"Representation of a 2 MB file (/dir3/2MB.file)" ljust at Bound.n + 0,0.3i
@@ -506,7 +511,7 @@
 	down
 	{ Bound: box height 6*bigboxht width 3.3*boxwid }
 	move 0.1i
-	box height fieldht invis "Tdata 2048 70"
+	box height fieldht invis "Tdata 70"
 	box height fieldht invis "0 0123456789"; {"contents of 2MB.file" at last box.e + 1i,0 ljust}
 	"Block 28 contents" at Bound.nw + 0,0.1i ljust
 }
@@ -517,7 +522,7 @@
 	down
 	{ Bound: box height 9*bigboxht width 3.3*boxwid }
 	move 0.1i
-	box height fieldht invis "Tdentry 1 72"
+	box height fieldht invis "Tdentry 72"
 	box height fieldht invis "qid.version 0"
 	box height fieldht invis "qid.path 72"
 	box height fieldht invis "size 26214400"
@@ -529,16 +534,16 @@
 	box height fieldht invis "gid -1"
 	box height fieldht invis "muid 10006"
 	box height fieldht invis "direct blocks"
-	box height fieldht invis "       0 8123 2048"
-	box height fieldht invis "       1 10171 2048"
-	box height fieldht invis "       2 12219 2048"
+	box height fieldht invis "       0 4195"
+	box height fieldht invis "       1 4196"
+	box height fieldht invis "       2 4197"
 	box height fieldht invis "."
 	box height fieldht invis "."
-	box height fieldht invis "       23 57249 2048"
+	box height fieldht invis "       31 4226"
 	box height fieldht invis "indirect blocks"
-	box height fieldht invis "       0 22434"
-	box height fieldht invis "       1 0"
-	box height fieldht invis "       2 0"
+	box height fieldht invis "       0 4228"
+	box height fieldht invis "       1 4291"
+	box height fieldht invis "       2 8198"
 	box height fieldht invis "       3 0"
 	box height fieldht invis "name 25MB.file"
 	"Block 4046 contents" at Bound.nw + 0,0.1i ljust
@@ -549,12 +554,12 @@
 	down
 	{ Bound: box height 4*bigboxht width 3.3*boxwid }
 	move 0.1i
-	box height fieldht invis "Tdata 2048 72"
+	box height fieldht invis "Tdata 72"
 	box height fieldht invis "0 0123456789"; {"starting contents" at last box.e + 1i,0 ljust;}
 	box height fieldht invis "."; {"of 25MB.file" at last box.e + 1i,0 ljust}	
 	box height fieldht invis "."
 	box height fieldht invis "."
-	"Block 8123 contents" at Bound.nw + 0,0.1i ljust
+	"Block 4195 contents" at Bound.nw + 0,0.1i ljust
 }
 move to Start - 0,9.5*bigboxht
 {
@@ -561,14 +566,14 @@
 	down
 	{ Bound: box height 6*bigboxht width 3.3*boxwid }
 	move 0.1i
-	box height fieldht invis "Tind0 1 72"
-	box height fieldht invis "	0 59297 2048"
-	box height fieldht invis "	1 18363 1"
-	box height fieldht invis "	2 0 0"
+	box height fieldht invis "Tind0 72"
+	box height fieldht invis "	0 4227"
+	box height fieldht invis "	1 4229"
+	box height fieldht invis "	2 4230"
 	box height fieldht invis "."
 	box height fieldht invis "."
-	box height fieldht invis "	49 0 0"
-	"Block 22434 contents" at Bound.nw + 0,0.1i ljust
+	box height fieldht invis "	61 4289"
+	"Block 4228 contents" at Bound.nw + 0,0.1i ljust
 }
 right
 move 4*boxwid
@@ -576,11 +581,11 @@
 	down
 	{ Bound: box height 4*bigboxht width 3.3*boxwid }
 	move 0.1i
-	box height fieldht invis "Tdata 2048 72"
-	box height fieldht invis "6789"; {"more content" at last box.e + 1i,0 ljust}
+	box height fieldht invis "Tdata 72"
+	box height fieldht invis "789"; {"more content" at last box.e + 1i,0 ljust}
 	box height fieldht invis "."; {"of 25MB.file" at last box.e + 1i,0 ljust}
 	box height fieldht invis "."
-	"Block 59297 contents" at Bound.nw + 0,0.1i ljust
+	"Block 4227 contents" at Bound.nw + 0,0.1i ljust
 }
 .PE
 .sp
binary files a/docs/mafs.pdf b/docs/mafs.pdf differ