diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | aio-cancel.c | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -4,3 +4,4 @@ aio-cancel-old cscope.* tags *.o +*.d diff --git a/aio-cancel.c b/aio-cancel.c index f5936cc..846fe6a 100644 --- a/aio-cancel.c +++ b/aio-cancel.c @@ -137,7 +137,7 @@ int main(int argc, char const *argv[]) exit(EXIT_FAILURE); } - blocks -= iosize / 512; + blocks -= iosize / 512; /* avoid reading past the end of the file */ printf("Doing %lu random reads to %s with iodepth %lu, iosize %lu\n", nr_ios, argv[1], iodepth, iosize); @@ -153,7 +153,7 @@ int main(int argc, char const *argv[]) iocb = malloc(sizeof(struct iocb)); io_prep_pread(iocb, fd, buffer, iosize, - (random() % blocks) * 512); + (random() % (blocks + 1)) * 512); ret = io_submit(io_ctx, 1, &iocb); if (ret != 1) |