zbd: Support zone reset by trim
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 6 Aug 2021 01:07:08 +0000 (10:07 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 6 Aug 2021 22:39:26 +0000 (16:39 -0600)
commite3be810bf0fdb9f5f50c2871974afb6021cad775
tree135a96f3140159c1b947615d676ae215a17d3550
parent5c86fdf6c34e4cc0eb2f6270f2f0b1caf933f4a1
zbd: Support zone reset by trim

Enable trim workload for zonemode=zbd by modifying do_io_u_trim() to
call zoned block device unique function zbd_do_io_u_trim() which resets
the target zone. This allows fio to emulate workloads which mix data
read/write and zone resets with zonemode=zbd.

To call reset zones, the trim I/O shall have offset aligned to zone
start and block size same as zone size. Reset zone is called only to
sequential write required zones and sequential write preferred zones.
Conventional zones are handled in same manner as regular block devices
by calling os_trim() function.

When zones are reset with random trim workload, choose only non-empty
zones as trim target. This avoids meaningless trim to empty zones and
makes the workload more realistic. To find the non-empty zones, utilize
zbd_find_zone() helper function which is already used for read workload,
specifying 1 byte as the minimum valid data size.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c
zbd.c
zbd.h