code: mafs

Download patch

ref: 2a5ba3cfc8748cd08bea89d93080948132f5aefe
parent: 60697954894f15834cbacd5d62184a68f4740890
author: 9ferno <gophone2015@gmail.com>
date: Wed Oct 26 21:48:05 EDT 2022

updated extents tests

--- a/docs/mafs.ms
+++ b/docs/mafs.ms
@@ -809,15 +809,16 @@
 .sp
 .nf
 struct Extent {
-	struct Extent *low, *high;	/* sorted by block number */
-	struct Extent *small, *big;/* sorted by the number of blocks in this extent */
-	u64 blkno;			/* block number */
-	u64 len; 				/* in blocks */
+	struct Extent *low, *high;	/* sorted by start */
+	u64 start;					/* where this extent starts from */
+	u64 len; 					/* how many units in this extent */
 };
 struct Extents {
 	Extent *lru;	/* least recently used extent */
-	QLock el;
-	u32 n;		/* number of extents */
+	Extent *head;	/* find the first block in a jiffy */
+	QLock lck;
+	u32 n;			/* number of extents */
+	Rendez isempty; 	/* fully used, nothing available */
 };
 .fi
 .sp
binary files a/docs/mafs.pdf b/docs/mafs.pdf differ
--- a/tests/extents/addabove/output
+++ b/tests/extents/addabove/output
@@ -1,5 +1,2 @@
 	20 .. 22
 	40 .. 43
-			ordered by size
-	20 .. 22 has 3 blocks
-	40 .. 43 has 4 blocks
--- a/tests/extents/addabove1/output
+++ b/tests/extents/addabove1/output
@@ -1,5 +1,2 @@
 	180 .. 183
 	250 .. 253
-			ordered by size
-	180 .. 183 has 4 blocks
-	250 .. 253 has 4 blocks
--- a/tests/extents/addbelow/output
+++ b/tests/extents/addbelow/output
@@ -1,5 +1,2 @@
 	180 .. 183
 	250 .. 253
-			ordered by size
-	180 .. 183 has 4 blocks
-	250 .. 253 has 4 blocks
--- a/tests/extents/mergeabove/output
+++ b/tests/extents/mergeabove/output
@@ -1,3 +1,1 @@
 	100 .. 112
-			ordered by size
-	100 .. 112 has 13 blocks
--- a/tests/extents/mergenext/output
+++ b/tests/extents/mergenext/output
@@ -1,3 +1,1 @@
 	101 .. 108
-			ordered by size
-	101 .. 108 has 8 blocks
--- a/tests/extents/mergeprevious/output
+++ b/tests/extents/mergeprevious/output
@@ -1,3 +1,1 @@
 	101 .. 108
-			ordered by size
-	101 .. 108 has 8 blocks
--- a/tests/testextents.c
+++ b/tests/testextents.c
@@ -28,7 +28,7 @@
 
 	ARGBEGIN{
 	default:	usage();
-	case 'D':	chatty9p=6; break;
+	case 'D':	chatty9p=8; break;
 	}ARGEND
 
 	if(argc != 0)
@@ -37,6 +37,7 @@
 	bp = Bfdopen(0, OREAD);
 	Blethal(bp, nil);
 
+	initextents(&es);
 	while((line = Brdstr(bp, '\n', 1)) != nil) {
 		bno = strtoull(line, &p, 10);
 		p++;	/* for the space */