zbd: Improve read randomness
authorDamien Le Moal <damien.lemoal@wdc.com>
Tue, 28 Aug 2018 04:47:23 +0000 (13:47 +0900)
committerDamien Le Moal <damien.lemoal@wdc.com>
Thu, 6 Sep 2018 01:09:10 +0000 (10:09 +0900)
commitde65f7b7596ae773f9d1f668ee4c09f88f1b4fd0
tree9a281601afe26d1ab233584e7a0de751558a08ae
parent1ef098712b688f81d014b2975fda5a278e582ca6
zbd: Improve read randomness

With zonemode=zbd, for random read operations with read_beyond_wp=0,
the zbd code will always adjust an I/O offset so that the I/O hits a
non empty zone. However, the adjustment always sets the I/O offset to
the start of the zone, resulting in a high device read cache hit rate
if the device has few zones written.

Improve randomness of read I/Os by adjusting the I/O offset to a random
value within the range of written data of the chosen zone. Also ensure
that the modified I/O does not cross over the zone wp position by
adjusting its size. Doing so, the search for a new zone is now done only
if the target zone cannot accomodate an I/O of at least min_bs bytes.

The comments have also been changed to better explain the code.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
zbd.c