Fix verification error with bsrange and split read/write phase
authorJens Axboe <axboe@fb.com>
Wed, 11 Nov 2015 01:13:40 +0000 (18:13 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 11 Nov 2015 01:13:40 +0000 (18:13 -0700)
If you have separate phases for the verify writes and the verify reads,
and fio ends up having to align to the verify interval header size,
then we can end up trimming the buflen on the read side (where
do_verify=1 is set), but not on the write side. This causes a
verification failure. Fix this by always aligning, regardless of
whether do_verify is true or not.

Example job files:

-------------------------------------------------------------------------------
[global]
thread=1
blocksize_range=4k-256k
ioengine=libaio
verify_interval=512
iodepth=64
loops=1
verify_pattern=0x03715998
size=100MB
offset=0
verify_dump=1
filename=/tmp/disk.img

[write-phase]
rw=randwrite
fill_device=1
do_verify=0
-------------------------------------------------------------------------------
[global]
thread=1
blocksize_range=4k-256k
ioengine=libaio
verify_interval=512
iodepth=64
loops=1
verify_pattern=0x03715998
size=100MB
offset=0
verify_dump=1
filename=/tmp/disk.img

[verify-phase]
stonewall
rw=randread
create_serialize=0
do_verify=1
-------------------------------------------------------------------------------

Reported-by: Kevin Vajk <kmv@datera.io>
Fixes: a9f70b1f5087 ("Make sure io_u->buflen is aligned to the verify_interval")
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 6dda5790a7f1d494fd46758ecc9b3b6406e4a11a..6b6b47d0a1e1284c24bc25fd74aa6d87ff7b97d6 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -488,7 +488,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
                        }
                }
 
                        }
                }
 
-               if (td->o.do_verify && td->o.verify != VERIFY_NONE)
+               if (td->o.verify != VERIFY_NONE)
                        buflen = (buflen + td->o.verify_interval - 1) &
                                ~(td->o.verify_interval - 1);
 
                        buflen = (buflen + td->o.verify_interval - 1) &
                                ~(td->o.verify_interval - 1);