oslib/linux-blkzoned: make sure that we always support zone capacity
authorNiklas Cassel <niklas.cassel@wdc.com>
Thu, 6 May 2021 13:18:45 +0000 (13:18 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 May 2021 15:25:34 +0000 (09:25 -0600)
commit6ee607ba9c5129ebf0bac1c42fa0a4700456cb88
treee42af5493708d6df8aeab6dbd86c42bd9e97b25c
parent79f488cbd95ca6989031a7ace5ec382313d31b3c
oslib/linux-blkzoned: make sure that we always support zone capacity

A common problem is that users upgrade their kernel to support NVMe ZNS
devices, however, they still use the kernel uapi headers provided by their
distro.

This means that even if the kernel will populate the zone capacity fields
for each zone in the zone report returned by the ioctl, fio will not know
how to interpret that data.

This leads to fio writing past the zone capacity, which will lead to
I/O errors.

It is not trivial for a user to realize that the kernel uapi headers
provided by their distro is the reason for these I/O errors.

In order to make it easier for these users, provide a copy of the current
zoned block device kernel uapi structs.

If the kernel uapi headers installed on the system are too old to support
zone capacity, use the locally defined structs instead.
If the installed headers are new enough to support zone capacity, use the
installed headers.

This way, fio will always be able to handle zone capacity (if the kernel
supports it). At the same time, we will not redefine any structs from the
installed headers if they are newer than our locally defined structs.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
oslib/linux-blkzoned.c