zbd: fix sequential write pattern with verify= and max_open_zones=
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 13 Apr 2020 18:51:55 +0000 (21:51 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 13 Apr 2020 23:18:31 +0000 (17:18 -0600)
commit25dc6606fbbaca35aec3009c4ff9512ed02d41ba
tree339db2bc6dc5a7c02fd6b69926710fe9dfedaaf5
parentfb0259fb276a5141f957a6521c019f2c8bc71046
zbd: fix sequential write pattern with verify= and max_open_zones=

Sequential write with max_open_zones=1 has interesting (read: buggy)
interaction with verify=.

If verify is off, then job runs correctly and IO is sequential,
and restarted from offset 0 and remains sequential.

If verify is on, then 1 full run is done and verified correctly.
At this point there is exactly 1 open zone which is the last zone.

Now IO restarts from offset 0 and pick_random_zone() picks opened zone
#0 which is the last zone because offset is 0. All IO is redirected
to the last zone, which is rewritten once triggering verify again.

IO pattern becomes: 1 full sequential rewrite followed by constant
sequential rewrites of the last zone.

[global]
filename=/dev/loop0
direct=1
zonemode=zbd
zonesize=1M
bs=512K
rw=write
verify=xxhash
[j]
max_open_zones=1
io_size=3G

Fix is to close every zone given that verification acts as a barrier
between jobs.

max_open_zones=2 can restart from half of the device, etc.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c