fio: fix last block never being touched by random offsets
authorPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Fri, 28 Feb 2014 17:09:13 +0000 (09:09 -0800)
committerJens Axboe <axboe@fb.com>
Fri, 28 Feb 2014 17:09:13 +0000 (09:09 -0800)
Fix the available range for random offsets which never touched the last block.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 77557dfdca12748f1db2249c05efc93a21b09f4b..75b23eb47d9091c58d3df19b2f6def826d3c3836 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -104,7 +104,7 @@ static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f,
 
                dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r);
 
 
                dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r);
 
-               *b = (lastb - 1) * (r / ((uint64_t) rmax + 1.0));
+               *b = lastb * (r / ((uint64_t) rmax + 1.0));
        } else {
                uint64_t off = 0;
 
        } else {
                uint64_t off = 0;