zbd: Add min_bytes argument to zbd_find_zone()
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 6 Aug 2021 01:07:07 +0000 (10:07 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 6 Aug 2021 22:39:25 +0000 (16:39 -0600)
commit5c86fdf6c34e4cc0eb2f6270f2f0b1caf933f4a1
tree42ea33d88c9b5493b7a50b69b159a04ad390916d
parent2459bd33b3dbb7a34f28c612d595311a6bc7593d
zbd: Add min_bytes argument to zbd_find_zone()

The helper function zbd_find_zone() finds a zone with at least
min_bs[DDIR_READ] bytes of readable data before the zone write pointer.
This patch generalizes this function to allow finding a non-empty zone.
To do so, add the min_bytes argument to specify the minimum readable
data of a zone to filter the search. Specifying 1 to min_bytes then
become equivalent to finding a non-empty zone.

This change will allow to reuse this function to find a suitable zone
for trim I/O.

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>
zbd.c