docs/zoned-storage: add zoned device documentation
RFC v5 11/11 docs/zoned-storage: add zoned device documentation
Add the documentation about the zoned device support to virtio-blk emulation.
--- docs/devel/zoned-storage.rst | 68 ++++++++++++++++++++++++++ docs/system/qemu-block-drivers.rst.inc | 6 +++ 2 files changed, 74 insertions(+) create mode 100644 docs/devel/zoned-storage.rst
docs/devel/zoned-storage.rst new file +68 -0
@@ -0,0 +1,68 @@ +============= +zoned-storage +============= + +Zoned Block Devices (ZBDs) devide the LBA space to block regions called zones +that are larger than the LBA size. It can only allow sequential writes, which +reduces write amplification in SSD, leading to higher throughput and increased +capacity. More details about ZBDs can be found at: + +https://zonedstorage.io/docs/introduction/zoned-storage + +zone emulation +-------------- +In its current status, the virtio-blk device is not aware of ZBDs but the guest +sees host-managed drives as regular drive that will runs correctly under the +most common write workloads. + +The zoned device support aims to let guests (virtual machines) access zoned +storage devices on the host (hypervisor) through a virtio-blk device. This +involves extending QEMU's block layer and virtio-blk emulation code. + +If the host supports zoned block devices, it can set VIRTIO_BLK_F_ZONED. Then +in the guest side, it appears following situations: +1) If the guest virtio-blk driver sees the VIRTIO_BLK_F_ZONED bit set, then it +will assume that the zoned characteristics fields of the config space are valid. +2) If the guest virtio-blk driver sees a zoned model that is NONE, then it is +known that is a regular block device. +3) If the guest virtio-blk driver sees a zoned model that is HM(or HA), then it +is known that is a zoned block device and probes the other zone fields. + +On QEMU sides, +1) The DEFINE PROP BIT macro must be used to declare that the host supports +zones. +2) BlockDrivers can declare zoned device support once known the zoned model +for the block device is not NONE. + +zoned storage APIs +------------------ + +Zone emulation part extends the block layer APIs and virtio-blk emulation section +with the minimum set of zoned commands that are necessary to support zoned +devices. The commands are - Report Zones, four zone operations and Zone Append +(developing). + +testing +------- + +It can be tested on a null_blk device using qemu-io, qemu-iotests or blkzone(8) +command in the guest os. + +1. For example, the command line for zone report using qemu-io is: + +$ path/to/qemu-io --image-opts driver=zoned_host_device,filename=/dev/nullb0 -c +"zrp offset nr_zones" + +To enable zoned device in the guest os, the guest kernel must have the virtio-blk +driver with ZBDs support. The link to such patches for the kernel is: + +https://github.com/dmitry-fomichev/virtblk-zbd + +Then, add the following options to the QEMU command line: +-blockdev node-name=drive0,driver=zoned_host_device,filename=/dev/nullb0 + +After the guest os booting, use blkzone(8) to test zone operations: +blkzone report -o offset -c nr_zones /dev/vda + +2. We can also use the qemu-iotests in ./tests/qemu-iotests/tests/zoned.sh. +
docs/system/qemu-block-drivers.rst.inc +6 -0
@@ -430,6 +430,12 @@ Hard disks you may corrupt your host data (use the ``-snapshot`` command line option or modify the device permissions accordingly). +Zoned block devices + Zoned block devices can passed through to the guest if the emulated storage + controller supports zoned storage. Use ``--blockdev zoned_host_device, + node-name=drive0,filename=/dev/nullb0`` to pass through ``/dev/nullb0`` + as ``drive0``. + Windows ^^^^^^^
Signature · 1 line
2.37.1
Quoted 17 lines · Sam Li
Add the documentation about the zoned device support to virtio-blk emulation.
Signed-off-by Sam Li <[email protected]>--- docs/devel/zoned-storage.rst | 68 ++++++++++++++++++++++++++ docs/system/qemu-block-drivers.rst.inc | 6 +++ 2 files changed, 74 insertions(+) create mode 100644 docs/devel/zoned-storage.rstdocs/devel/zoned-storage.rst new file +0
-0
docs/devel/zoned-storage.rst line 5
Quoted 5 lines
docs/devel/zoned-storage.rst new file +5
-0@@ -0,0 +1,68 @@ +============= +zoned-storage +============= + +Zoned Block Devices (ZBDs) devide the LBA space to block regions called zones
s/space to block/space into block/
docs/devel/zoned-storage.rst line 7
Quoted 2 lines
docs/devel/zoned-storage.rst new file +2
-0+that are larger than the LBA size. It can only allow sequential writes, which +reduces write amplification in SSD, leading to higher throughput and increased
s/SSD/SSDs/
docs/devel/zoned-storage.rst line 16
Quoted 9 lines
docs/devel/zoned-storage.rst new file +9
-0+capacity. More details about ZBDs can be found at: + +https://zonedstorage.io/docs/introduction/zoned-storage + +zone emulation +-------------- +In its current status, the virtio-blk device is not aware of ZBDs but the guest +sees host-managed drives as regular drive that will runs correctly under the +most common write workloads.
I don't understand this paragraph. I suggest dropping it. virtio-blk can be mentioned further down.
docs/devel/zoned-storage.rst line 20
Quoted 4 lines
docs/devel/zoned-storage.rst new file +4
-0+ +The zoned device support aims to let guests (virtual machines) access zoned +storage devices on the host (hypervisor) through a virtio-blk device. This +involves extending QEMU's block layer and virtio-blk emulation code.
This text is specific to your Outreachy project with the goal of passing through zoned devices via virtio-blk. I suggest writing this documentation from a broader point of view (emulated storage controllers and core block layer APIs) and not focussing specifically on virtio-blk:
1. Block layer APIs for zoned storage
Discuss the QEMU block layer's zoned storage model here. Mention BlockLimits and how block drivers declare support for zoned storage.
2. Emulating zoned storage controllers
Discuss how emulated storage controllers can use the block layer APIs when the BlockBackend's BlockLimits model reports a zoned storage device.
This will help developers who aren't familiar with virtio-blk. References to virtio-blk make it harder for them to understand how they should use zoned storage.
Quoted 10 lines
docs/devel/zoned-storage.rst new file +10
-0+ +If the host supports zoned block devices, it can set VIRTIO_BLK_F_ZONED. Then +in the guest side, it appears following situations: +1) If the guest virtio-blk driver sees the VIRTIO_BLK_F_ZONED bit set, then it +will assume that the zoned characteristics fields of the config space are valid. +2) If the guest virtio-blk driver sees a zoned model that is NONE, then it is +known that is a regular block device. +3) If the guest virtio-blk driver sees a zoned model that is HM(or HA), then it +is known that is a zoned block device and probes the other zone fields. +
docs/devel/zoned-storage.rst line 40
Quoted 10 lines
docs/devel/zoned-storage.rst new file +10
-0+On QEMU sides, +1) The DEFINE PROP BIT macro must be used to declare that the host supports +zones. +2) BlockDrivers can declare zoned device support once known the zoned model +for the block device is not NONE. + +zoned storage APIs +------------------ + +Zone emulation part extends the block layer APIs and virtio-blk emulation section
It's often clearer to describe new features directly instead of the extensions, changes, or old vs new. The person reading this might not be familiar with QEMU's block APIs before zoned storage and they don't care what changed. They just need to know what zoned storage APIs are available and how to use them.
Here I would say only "The block layer APIs support commands needed for zoned storage devices, including report zones, four zone operations, and zone append".
When discussing the zoned storage APIs, avoid mentioning storage controller emulation as the user of the block API. That is just one use case. It's possible that zoned storage APIs will be used in other ways in the future. For example, the qcow2 image format driver could be optimized for zoned storage devices by laying out and accessing its metadata on zoned devices using the block APIs. The documentation should be general enough that someone intending to use the block APIs differently shouldn't have to know about zoned storage controller emulation in order to figure out how to use the block APIs for other purposes.
Quoted 33 lines
docs/devel/zoned-storage.rst new file +28
-0+with the minimum set of zoned commands that are necessary to support zoned +devices. The commands are - Report Zones, four zone operations and Zone Append +(developing). + +testing +------- + +It can be tested on a null_blk device using qemu-io, qemu-iotests or blkzone(8) +command in the guest os. + +1. For example, the command line for zone report using qemu-io is: + +$ path/to/qemu-io --image-opts driver=zoned_host_device,filename=/dev/nullb0 -c +"zrp offset nr_zones" + +To enable zoned device in the guest os, the guest kernel must have the virtio-blk +driver with ZBDs support. The link to such patches for the kernel is: + +https://github.com/dmitry-fomichev/virtblk-zbd + +Then, add the following options to the QEMU command line: +-blockdev node-name=drive0,driver=zoned_host_device,filename=/dev/nullb0 + +After the guest os booting, use blkzone(8) to test zone operations: +blkzone report -o offset -c nr_zones /dev/vda + +2. We can also use the qemu-iotests in ./tests/qemu-iotests/tests/zoned.sh. +docs/system/qemu-block-drivers.rst.inc +0
-0
docs/system/qemu-block-drivers.rst.inc Hard disks · line 434
Quoted 5 lines
docs/system/qemu-block-drivers.rst.inc +2
-0@@ -430,6 +430,12 @@ Hard disks you may corrupt your host data (use the ``-snapshot`` command line option or modify the device permissions accordingly). +Zoned block devices + Zoned block devices can passed through to the guest if the emulated storage
s/can passed/can be passed/
Quoted 11 lines
docs/system/qemu-block-drivers.rst.inc +4
-1+ controller supports zoned storage. Use ``--blockdev zoned_host_device, + node-name=drive0,filename=/dev/nullb0`` to pass through ``/dev/nullb0`` + as ``drive0``. + Windows ^^^^^^^ --2.37.1