code: mafs

Download patch

ref: 60697954894f15834cbacd5d62184a68f4740890
parent: b055ce05f9e89d524b11ec1dbc40f0d5b93707b4
author: 9ferno <gophone2015@gmail.com>
date: Wed Oct 26 14:28:45 EDT 2022

updated document with the in-memory block contents

--- a/docs/mafs.ms
+++ b/docs/mafs.ms
@@ -50,6 +50,7 @@
 	Extents: box invis "Extents" "free blocks" with .nw at Datastructures.se + 0.5i,0
 	move 0.5*boxwid
 	Writer: box invis "writer" with .nw at Buffercache.ne + 0.4i,0
+	Inmemory: box invis "In-memory" "block contents" with .sw at Buffercache.n + 0.5i,0
 	down
 	move 0.5*boxwid
 	Disk: box "Disk" "blocks" height 1.5*boxht with .sw at Extents.se + 0.4i,0
@@ -63,6 +64,8 @@
 	line -> from Writer.s + 0,0.1i to Disk.n
 	line <-> from Extents.e to Disk.w
 	line <-> from Buffercache.s to Extents.n
+	line <-> from Buffercache.ne - 0,0.1i to Inmemory.sw + 0,0.1i
+	line <-> from Writer.n - 0,0.1i to Inmemory.s + 0.2i,0.1i
 .PE
 .sp
 .sp
@@ -111,16 +114,11 @@
 .nf
 struct Tag
 {
-	u64 path;	/* Qid.path, unique identifier of directory or file */
 	u8 type;	/* Tfree, Tmagic, Tdentry, Tdata, Tind\fIn\fR */
-	u8 dirty;	/* is 1, when being written to.
-				Identifies dirty data on a crash.
-				This byte position is denoted by the enum Nthdirty. */
+	u64 path;	/* Qid.path, unique identifier of directory or file */
 };
 .fi
 .sp
-A block in the process of being written is marked dirty (Tag.dirty = 1). After a successful write, the Tag.dirty is set to 0. This helps identify dirty blocks after a crash.
-.sp
 Every file or directory is represented on the disk by a directory entry (Dentry). A directory entry uses a block (Tag.type = Tdentry) and is uniquely identifiable by a Qid.
 .sp
 A file stores its contents in blocks with a Tag.type of Tdata. A directory holds the directory entries of it's children in blocks with a Tag.type of Tdentry.
@@ -688,7 +686,7 @@
 		u8	*xiobuf;	/* "real" buffer pointer */
 		Content *io;	/* cast'able to contents */
 	};
-	Ref	dirties;	/* number of dirty blocks yet to be written by the writer */
+	Ref	dirties;	/* number of versions of this block yet to be written by the writer */
 };
 .fi
 .sp
@@ -750,7 +748,7 @@
 .fi
 .sp
 .sp
-.ne 4
+.ne 10
 .ft B
 Asynchronous writes
 .ft R
binary files a/docs/mafs.pdf b/docs/mafs.pdf differ