io_u: ensure we generate the full length of block sizes
authorJens Axboe <axboe@kernel.dk>
Tue, 10 Jul 2018 21:10:17 +0000 (15:10 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Jul 2018 21:10:17 +0000 (15:10 -0600)
Since we round down, we can miss the last entry. This ensures that
if we do:

bsrange=4k-16k

we actually get an even split of 4,8,12,16k ios.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c

diff --git a/io_u.c b/io_u.c
index 9e9dad5..5221a78 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -541,10 +541,8 @@ static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u,
                r = __rand(&td->bsrange_state[ddir]);
 
                if (!td->o.bssplit_nr[ddir]) {
-                       buflen = 1 + (unsigned int) ((double) maxbs *
+                       buflen = minbs + (unsigned int) ((double) maxbs *
                                        (r / (frand_max + 1.0)));
-                       if (buflen < minbs)
-                               buflen = minbs;
                } else {
                        long long perc = 0;
                        unsigned int i;