diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-11-29 02:46:10 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-11-29 02:46:10 +0100 |
commit | 1e5e50e44df26a15268132dc14b5d3d9cda178ff (patch) | |
tree | ba1fc9d5d592c94cb290cc8e17966b509c9ebfe4 | |
parent | 5df9c1947bd102309ee93c6354dcad1352218e7b (diff) | |
download | fwbench-1e5e50e44df26a15268132dc14b5d3d9cda178ff.tar.gz fwbench-1e5e50e44df26a15268132dc14b5d3d9cda178ff.tar.bz2 fwbench-1e5e50e44df26a15268132dc14b5d3d9cda178ff.tar.xz fwbench-1e5e50e44df26a15268132dc14b5d3d9cda178ff.zip |
Fixes bugs in AIO mode
-rw-r--r-- | seqreader.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/seqreader.c b/seqreader.c index 55a7370..78d7eae 100644 --- a/seqreader.c +++ b/seqreader.c @@ -134,8 +134,17 @@ int main(int argc, char *argv[]) { ready = 0; while (1) { if (!done[curio%(AIO_MODE + EXTRA_BUFFERS)]) { - err = io_getevents(aio, 1, AIO_MODE - events, &ev[events], NULL); - if (err < 0) perror("Error waiting for AIO\n"); +// printf("%i,%i - %i [%i %i %i %i]\n", curio, schedio, events, done[0], done[1], done[2], done[3]); + + if (curio < schedio) { + err = io_getevents(aio, 1, AIO_MODE + EXTRA_BUFFERS - events, &ev[events], NULL); + if (err < 0) { + printf("Error waiting for AIO (%i)\n", -err); + exit(-1); + } + } else { + err = 0; + } if ((!ready)&&(err > 1)) { printf("*** Multiple read requests (%i of %i) are finished simultaneously. It is either:\n", err, AIO_MODE); @@ -154,6 +163,7 @@ int main(int argc, char *argv[]) { events += err; for (i = events - 1; (i >= 0)&&((schedio - curio) < (AIO_MODE + EXTRA_BUFFERS)); i--) { +// printf("sched (%i): %i\n", i, schedio); struct iocb *newio = (struct iocb *)ev[i].obj; memset(newio, 0, sizeof(struct iocb)); io_prep_pread(newio, fd, buffer + (schedio % (AIO_MODE + EXTRA_BUFFERS)) * BLOCK_SIZE, BLOCK_SIZE, schedio * BLOCK_SIZE); |