file-posix: fix zone write granularity assignment for zoned block devices
PATCH v2 1/1 file-posix: fix zone write granularity assignment for zoned block devices
In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size.
However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size.
In Linux, there is a zone_write_granularity sysfs property which abstracts this away, so let's make use of it.
Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size.
---
Changes since v1:
-Improved commit log.
-Picked up tag.
block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/file-posix.c +1 -1
@@ -1495,7 +1495,7 @@ static void raw_refresh_zoned_limits(BlockDriverState *bs, struct stat *st, bs->bl.max_append_sectors = ret >>BDRV_SECTOR_BITS ; } - ret =get_sysfs_long_val (st,"physical_block_size" ); + ret =get_sysfs_long_val (st,"zone_write_granularity" );if (ret >=0 ) { bs->bl.write_granularity = ret; }
Signature · 1 line
2.55.0
Quoted 21 lines · Niklas Cassel
In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size.
However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size.
In Linux, there is a
zone_write_granularitysysfs property which abstracts this away, so let's make use of it.Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size.
Reviewed-by Damien Le Moal <[email protected]>Fixes a3c41f06d5a8 ("file-posix: add tracking of the zone write pointers")Signed-off-by Niklas Cassel <[email protected]>---
Changes since v1:
Review
Quoted 5 lines
(quoted diff) +0
-2-Improved commit log. -Picked up tag. block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines · Niklas Cassel
In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size.
However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size.
In Linux, there is a
zone_write_granularitysysfs property which abstracts this away, so let's make use of it.
Quoted 8 lines
Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size.
Reviewed-by Damien Le Moal <[email protected]>Fixes a3c41f06d5a8 ("file-posix: add tracking of the zone write pointers")Signed-off-by Niklas Cassel <[email protected]>---
Stefan,
Since you already have another zoned storage fix for file-posix.c queued:
https://gitlab.com/stefanha/qemu/-/commits/block-next
Could you perhaps queue this one as well?
Kind regards,
Niklas
Stefan Hajnoczi
AppliedQuoted 22 lines · Niklas Cassel
Quoted 12 lines · Niklas Cassel
In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size.
However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size.
In Linux, there is a
zone_write_granularitysysfs property which abstracts this away, so let's make use of it.Quoted 8 lines
Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size.
Reviewed-by Damien Le Moal <[email protected]>Fixes a3c41f06d5a8 ("file-posix: add tracking of the zone write pointers")Signed-off-by Niklas Cassel <[email protected]>---
Quoted 6 lines
Stefan,
Since you already have another zoned storage fix for
file-posix.cqueued:
https://gitlab.com/stefanha/qemu/-/commits/block-nextCould you perhaps queue this one as well?
Yes. Kevin is away for a few days and this is a small patch, so I will merge it.
Applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block
Stefan