Better accommodate random writes larger than blockalign
authorJustin Eno <jeno@micron.com>
Tue, 27 Jan 2015 22:23:20 +0000 (14:23 -0800)
committerJens Axboe <axboe@fb.com>
Wed, 28 Jan 2015 16:08:52 +0000 (09:08 -0700)
fill_io_u() fails prematurely if the randomly-chosen offset satisfies
blockalign but not min_bs, i.e., the offset lies too near the end of
the target region.  This change honors both parameters.

Signed-off-by: Justin Eno <jeno@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 5971d78b635e6d31c352f187042cc238c0fd7428..77a3abf75437e7e27290cf0e32fc4db7cb3bc7ce 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -68,6 +68,9 @@ static uint64_t last_block(struct thread_data *td, struct fio_file *f,
        if (td->o.zone_range)
                max_size = td->o.zone_range;
 
+       if (td->o.min_bs[ddir] > td->o.ba[ddir])
+               max_size -= td->o.min_bs[ddir] - td->o.ba[ddir];
+
        max_blocks = max_size / (uint64_t) td->o.ba[ddir];
        if (!max_blocks)
                return 0;