Fix rand_seed mismatches in verify phase
authorPuthikorn Voravootivat <puthik@chromium.org>
Wed, 5 Feb 2014 17:17:11 +0000 (10:17 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 5 Feb 2014 17:17:11 +0000 (10:17 -0700)
commitc4b6117b236370b174f3e3d2e299bf8b3733be97
tree5e84c624432759a757abb0ce04ee68b89d2fddd2
parentd10983d78c4d468c00898af2a0f452530f52a18c
Fix rand_seed mismatches in verify phase

In verify phase, the rand_seed generated on replay does not match
the written rand_seed.

Multiple problems are causing this:
1. In verify phase fio does not set io_u->rand_seed to compare with
   hdr->rand_seed
2. In randrw scenario, fio log is stored in red-black tree in "sorted by LBA"
   order.  Thus, it is imposible to replay the written order, or rather
   generate the seeds again in the same order.
3. In write phase, the code currently will generate rand_seed, write data
   and log rand_seed. When queuedepth > 1, it's possible the writes complete
   in a different order than rand_seed was generated.  Thus when replaying
   the log, the generated rand_seed might not match what was written.
4. verify_backlog option will start verification before all the data has been
   written and it make rand_seed replay code broken with current design.

Proposed fixes:
1. Use of existing verify_state to generate verify header.
   (and assumes this was the original intention of verify_state). And also
   adds code to replay rand_seed in verify phase.
2. If verifysort option is not enabled, store the write log in a list instead
   of the red-black tree. Otherwise, don't attempt to verify the rand_seed
   in the header.
3. In write phase,  generate rand_seed, log rand_seed, write data. I.e. log
   IO transactions in the order generated, not completed.
4. Don't verify rand_seed when verify_backlog is enabled.

Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
io_u.c
iolog.c
verify.c