iolog: Ignore re-add/re-open with replay_redirect
authorSitsofe Wheeler <sitsofe@yahoo.com>
Mon, 12 Dec 2016 12:11:39 +0000 (12:11 +0000)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Mon, 12 Dec 2016 12:13:28 +0000 (12:13 +0000)
commit96d663ad34f1def5c41a8fe656c15d5c312dffe2
treeb44d2469f759b783cc6a3a207e648acb6ca247f7
parent487197d9e8f3aa0f135a6d88e5f222a1a930723a
iolog: Ignore re-add/re-open with replay_redirect

The HOWTO entry for replay_redirect says:
"Replay_redirect causes all IOPS to be replayed onto
the single specified device regardless of the device it was
recorded from. i.e. replay_redirect=/dev/sdc would cause all
IO in the blktrace or iolog to be replayed onto /dev/sdc.
This means multiple devices will be replayed onto a single
device, if the trace contains multiple devices."

Unfortunately trying to replay the following iolog (saved as
redirtest.fiolog):
fio version 2 iolog
/dev/sdb add
/dev/sdc add
/dev/sdb open
/dev/sdc open
/dev/sdb read 0 512
/dev/sdc read 512 512
/dev/sdb close
/dev/sdc close

with an fio line like
fio --name=redirtest --replay_redirect=/dev/nullb0 --read_iolog=redirtest.fiolog
winds up hitting this assertion:
fio: ioengines.c:413: td_io_open_file: Assertion `!fio_file_open(f)' failed.
which occurs because after redirection is applied /dev/nullb0 is added and
opened twice.

Fix this by ignoring subsequent adds or opens for the same file during
iolog replay setup when replay_redirect is in effect.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
iolog.c