ref: 6b09e37bdb54eae89999d723d2faf2aaacbd221b
parent: 436910b0bc02717fbf3c1cce05069cccf25dc7fa
author: 9ferno <[email protected]>
date: Sun Nov 27 15:30:31 EST 2022
throttle test.7 usage as it keeps using too many work buffers and crashing drawterm
--- a/ctl.c
+++ b/ctl.c
@@ -75,61 +75,62 @@
void
ctlread(Req *req)
{
- u64 free, used;
- char buf[1024];
+ u64 nfree, used;
+ char *buf;
int n;
- free = nfrees(&frees);
- used = config.nblocks - free;
+ nfree = nfrees(&frees);
+ used = config.nblocks - nfree;
-/* n = snprint(buf, 1024, "pending writes %llud blocks\n", pendingwrites());*/
- n = snprint(buf, 1024, "hash buckets:\n");
- n += showhashbuckets(buf+n, 1024-n);
- n += snprint(buf+n, 1024-n, "memunits extents:\n");
- n += saveextents(&memunits, buf+n, 1024-n);
- n += snprint(buf+n, 1024-n, "frees extents:\n");
- n += saveextents(&frees, buf+n, 1024-n);
+ buf = emalloc9p(MiB);
+/* n = snprint(buf, MiB, "pending writes %llud blocks\n", pendingwrites());*/
+ n = snprint(buf, MiB, "hash buckets:\n");
+ n += showhashbuckets(buf+n, MiB-n);
+ n += snprint(buf+n, MiB-n, "memunits extents:\n");
+ n += saveextents(&memunits, buf+n, MiB-n);
+ n += snprint(buf+n, MiB-n, "frees extents:\n");
+ n += saveextents(&frees, buf+n, MiB-n);
if(config.size > TiB)
- n += snprint(buf+n, 1024-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
+ n += snprint(buf+n, MiB-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
"(MiB) free %ulld, used %ulld, total %ulld\n"
"(GiB) free %ulld, used %ulld, total %ulld\n"
"(TiB) free %ulld, used %ulld, total %ulld\n",
- free, used, config.nblocks,
- free * Blocksize / MiB,
+ nfree, used, config.nblocks,
+ nfree * Blocksize / MiB,
used * Blocksize / MiB,
config.size / MiB,
- free * Blocksize / GiB,
+ nfree * Blocksize / GiB,
used * Blocksize / GiB,
config.size / GiB,
- free * Blocksize / TiB,
+ nfree * Blocksize / TiB,
used * Blocksize / TiB,
config.size / TiB
);
else if(config.size > GiB)
- n += snprint(buf+n, 1024-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
+ n += snprint(buf+n, MiB-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
"(MiB) free %ulld, used %ulld, total %ulld\n"
"(GiB) free %ulld, used %ulld, total %ulld\n",
- free, used, config.nblocks,
- free * Blocksize / MiB,
+ nfree, used, config.nblocks,
+ nfree * Blocksize / MiB,
used * Blocksize / MiB,
config.size / MiB,
- free * Blocksize / GiB,
+ nfree * Blocksize / GiB,
used * Blocksize / GiB,
config.size / GiB
);
else if(config.size > MiB)
- n += snprint(buf+n, 1024-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
+ n += snprint(buf+n, MiB-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
"(MiB) free %ulld, used %ulld, total %ulld\n",
- free, used, config.nblocks,
- free * Blocksize / MiB,
+ nfree, used, config.nblocks,
+ nfree * Blocksize / MiB,
used * Blocksize / MiB,
config.size / MiB
);
else
- n += snprint(buf+n, 1024-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
+ n += snprint(buf+n, MiB-n, "(blocks) free %ulld, used %ulld, total %ulld\n"
"(KiB) free %ulld, used %ulld, total %ulld\n",
- free, used, config.nblocks,
- free * Blocksize / KiB,
+ nfree, used, config.nblocks,
+ nfree * Blocksize / KiB,
used * Blocksize / KiB,
config.size / KiB
);
@@ -139,6 +140,7 @@
req->ofcall.offset = req->ifcall.offset+req->ofcall.count;
}
respond(req, nil);
+ free(buf);
}
u32 mpsrvpid = 0;
--- a/iobuf.c
+++ b/iobuf.c
@@ -71,9 +71,9 @@
wunlock(p);
}else
strcpy(locked, "locked");
- if(p->io->tag == Tdata)
+ if(p->tag == Tdata)
n = snprint(buf, nbuf, "%s %llud %s\n",
- tagnames[p->io->tag], p->blkno, locked);
+ tagnames[p->tag], p->blkno, locked);
else{
if(p->m->d[0].tag > Tdata && p->m->d[0].tag < MAXTAG){
tag = p->m->d[0].tag;
--- a/tests/regress.rc
+++ b/tests/regress.rc
@@ -26,9 +26,9 @@
# start service
if(~ $"debug '')
- mount -c <{disk/^$cmd -s -r $test $disk <[0=1]} /n/^$service
+ mount -c <{disk/^$cmd $cmdparams -s -r $test $disk <[0=1]} /n/^$service
if not # if auth negotiation breaks, something is writing to fd 1.
- mount -c <{disk/^$cmd $"debug -s -r $test $disk <[0=1]} /n/^$service
+ mount -c <{disk/^$cmd $cmdparams $"debug -s -r $test $disk <[0=1]} /n/^$service
echo service status: $status
sleep 1
@@ -66,9 +66,9 @@
# start service
if(~ $"debug '')
- disk/^$cmd -r $test $disk
+ disk/^$cmd $cmdparams -r $test $disk
if not
- disk/^$cmd $"debug -r $test $disk
+ disk/^$cmd $cmdparams $"debug -r $test $disk
echo service status: $status
mount -c /srv/^$test /n/^$service
--- a/tests/test.7/action.rc
+++ b/tests/test.7/action.rc
@@ -4,7 +4,7 @@
# ls -l /srv/ /n/
-for(i in `{seq 1 1 10}){
+for(i in `{seq 1 1 3}){
time fcp -x test.7/16384_blocks.file /n/^$service^/16384_blocks.file.^$i &
}
--- a/tests/test.7/params
+++ b/tests/test.7/params
@@ -1,1 +1,2 @@
-nblocks=1638400
+nblocks=163840
+cmdparams=(-m 65536)