If io_size isn't a multiple of the block size, weird things can
happen, which usually means that fio will exit with an unaligned
IO error:
fio: io_u error on file /dev/nvme0n1: Invalid argument: write offset=125830, buflen=
1048576
where offset=125830 really should have been aligned to the block
size. Ensure that we do that.
Signed-off-by: Jens Axboe <axboe@fb.com>
assert(ddir_rw(ddir));
if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f) &&
- o->time_based)
- f->last_pos[ddir] = f->last_pos[ddir] - f->io_size;
+ o->time_based) {
+ struct thread_options *o = &td->o;
+ uint64_t io_size = f->io_size + (f->io_size % o->min_bs[ddir]);
+
+ if (io_size > f->last_pos[ddir])
+ f->last_pos[ddir] = 0;
+ else
+ f->last_pos[ddir] = f->last_pos[ddir] - io_size;
+ }
if (f->last_pos[ddir] < f->real_file_size) {
uint64_t pos;