io_u: fix trimming of mixed block size randommap
authorJens Axboe <axboe@kernel.dk>
Tue, 12 Sep 2017 20:02:34 +0000 (14:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 12 Sep 2017 20:02:34 +0000 (14:02 -0600)
If you run something ala:

fio --name=test --filename=/dev/sda --rw=randread --size=1M --bs=128k,64k --ioengine=libaio --io_submit_mode=offload

where the you have different block sizes for reads and writes, we can
get into a situation where we have to trim IO size for a read
(128k bs), but we use the general minimum block size, which is 64k
That results in a case where we incorrectly reset the IO size to
0, resulting in an invalid IO.

Fixes: https://github.com/axboe/fio/issues/458
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c

diff --git a/io_u.c b/io_u.c
index db043e4acce6a5c6b81a216caed5eba6ca2d587a..e98cd31806bd0da4ba2feaea33404e41a62eb17a 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -37,7 +37,7 @@ static bool random_map_free(struct fio_file *f, const uint64_t block)
  */
 static void mark_random_map(struct thread_data *td, struct io_u *io_u)
 {
-       unsigned int min_bs = td->o.rw_min_bs;
+       unsigned int min_bs = td->o.min_bs[io_u->ddir];
        struct fio_file *f = io_u->file;
        unsigned int nr_blocks;
        uint64_t block;