code: mafs

Download patch

ref: 4e38ae914082c603f04ce820b0ac167c65bd02d2
parent: fb53d7e68bcb2108fb304c81dccb1d7ff50ffa1f
author: 9ferno <gophone2015@gmail.com>
date: Sun Dec 4 15:43:08 EST 2022

fsck bug fix

--- a/9p.c
+++ b/9p.c
@@ -66,6 +66,8 @@
 		authdestroy(fid);
 		return;
 	}
+	if(fid->aux == nil)
+		return;
 	if(((Aux*)fid->aux)->tlocked == 1){
 		qlock(&tlock);
 		if(tlocktail == nil){
@@ -1562,8 +1564,7 @@
 	newbufsize = 0;
 	newbuf->io->dblkno = dblkno;
 
-	/* read from the last block */
-	/* copy that to the new allocated blocks */
+	/* read from the last block and copy that to the newly allocated blocks */
 	oldbuf = nil;
 	if(lastdatablksize=d->size%Maxdatablocksize){
 		/* partial block, above is = not == */
--- a/dat.h
+++ b/dat.h
@@ -160,7 +160,6 @@
 struct Super
 {
 	u64 qidgen;	/* generator for unique ids. starts from 1024. */
-				/* TODO make fsok a time stamp in nano seconds */
 	u64 fsok;	/* fsck status, using 64 bits to keep it all aligned */
 };
 struct Dentry
--- a/fsck
+++ b/fsck
@@ -11,7 +11,7 @@
 nblocks=`{disk/block $disk 2 | awk '$1 == "nblocks"{ print $2 }'}
 
 # write the free extents to /adm/frees
-disk/updatefrees $disk <{disk/unused $nblocks <{disk/used $disk}
+disk/updatefrees $disk <{disk/unused $nblocks <{disk/used $disk}}
 
 # change fsok from 0 to 1
 disk/fsok $disk