ref: ec28057f56f2ea7856e7d4e718ab4ac935ea7c40
parent: 0b777b5a055f01dc6bb36cd346ec50f732469272
author: 9ferno <[email protected]>
date: Sat Dec 17 03:26:02 EST 2022
Revert "allocate Maxdatablockunits from the top and the rest from the bottom" This reverts commit 078f4e3ec486fe4eb5e10b2cdfe15ad09a1db347.
--- a/extents.c
+++ b/extents.c
@@ -456,7 +456,7 @@
}
u64
-slicetop(Extents *es, Extent *e, u64 len)
+slice(Extents *es, Extent *e, u64 len)
{
u64 oldstart, oldlen;
@@ -464,19 +464,6 @@
panic("pluck(): should not happen");
oldlen = e->len;
oldstart = pluck(es, e);
- add(es, oldstart, oldlen - len);
- return oldstart+oldlen-len;
-}
-
-u64
-slicebottom(Extents *es, Extent *e, u64 len)
-{
- u64 oldstart, oldlen;
-
- if(es == nil || e == nil || es->lru == nil || len == 0 || e->len <= len)
- panic("pluck(): should not happen");
- oldlen = e->len;
- oldstart = pluck(es, e);
add(es, oldstart+len, oldlen - len);
return oldstart;
}
@@ -501,12 +488,8 @@
showextents(2, msg, es);
}*/
again:
- if(n == Maxdatablockunits)
- for(e = highest(es); e != nil && e->len < n; e = e->low)
- ;
- else
- for(e = lowest(es); e != nil && e->len < n; e = e->high)
- ;
+ for(e = lowest(es); e != nil && e->len < n; e = e->high)
+ ;
if(e == nil){
snprint(msg, 64, "balloc() %llud %s: waiting\n", n, es->name);
showextents(2, msg, es);
@@ -520,12 +503,8 @@
}
else if(e->len == n)
start = pluck(es, e);
- else{ /* found something bigger */
- if(n == Maxdatablockunits)
- start = slicetop(es, e, n);
- else
- start = slicebottom(es, e, n);
- }
+ else /* found something bigger */
+ start = slice(es, e, n);
qunlock(&es->lck);
return start;
--- /dev/null
+++ b/tests/test.3/blocks/40956
@@ -1,0 +1,1 @@
+Tblank