mbox series

[RFC,v4,0/9] Add support for zoned device

Message ID 20220712021345.8530-1-faithilikerun@gmail.com (mailing list archive)
Headers show
Series Add support for zoned device | expand

Message

Sam Li July 12, 2022, 2:13 a.m. UTC
This patch series adds support for zoned device to virtio-blk emulation. Zoned
Storage can support sequential writes, which reduces write amplification in SSD,
leading to higher write throughput and increased capacity.

v4:
- add block layer APIs (revision)
- add configurations for zoned block device

Sam Li (9):
  block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.
  qemu-io: add zoned block device operations.
  file-posix: introduce get_sysfs_long_val for a block queue of sysfs
    attribute
  file-posix: introduce get_sysfs_str_val for device zoned model.
  qemu-iotests: test new zone operations.
  raw-format: add zone operations
  config: add check to block layer
  include: add support for zoned block devices
  qapi: add support for zoned host device

 block.c                                     |   7 +
 block/block-backend.c                       |  41 +++
 block/coroutines.h                          |   5 +
 block/file-posix.c                          | 334 +++++++++++++++++++-
 block/io.c                                  |  57 ++++
 block/raw-format.c                          |  13 +
 include/block/block-common.h                |  43 ++-
 include/block/block-io.h                    |  13 +
 include/block/block_int-common.h            |  25 ++
 include/standard-headers/linux/virtio_blk.h | 157 ++++++++-
 qapi/block-core.json                        |   7 +-
 qemu-io-cmds.c                              | 143 +++++++++
 tests/qemu-iotests/tests/zoned.sh           |  69 ++++
 13 files changed, 888 insertions(+), 26 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/zoned.sh

Comments

Markus Armbruster July 12, 2022, 5:47 a.m. UTC | #1
Sam Li <faithilikerun@gmail.com> writes:

> This patch series adds support for zoned device to virtio-blk emulation. Zoned
> Storage can support sequential writes, which reduces write amplification in SSD,
> leading to higher write throughput and increased capacity.

Forgive me if this has already been discussed, or is explained deeper in
the patch series...

The commit message sounds like you're extending virtio-blk to optionally
emulate zoned storage.  Correct?

PATCH 1 adds a new block block device driver 'zoned_host_device', and
PATCH 9 exposes it in QAPI.  This is for passing through a zoned host
device, correct?
Sam Li July 12, 2022, 5:59 a.m. UTC | #2
Markus Armbruster <armbru@redhat.com> 于2022年7月12日周二 13:47写道:
>
> Sam Li <faithilikerun@gmail.com> writes:
>
> > This patch series adds support for zoned device to virtio-blk emulation. Zoned
> > Storage can support sequential writes, which reduces write amplification in SSD,
> > leading to higher write throughput and increased capacity.
>
> Forgive me if this has already been discussed, or is explained deeper in
> the patch series...
>
> The commit message sounds like you're extending virtio-blk to optionally
> emulate zoned storage.  Correct?

Yes! The main purpose is to emulate zoned storage only for the zoned
device files. Right now, QEMU sees those as regular block devices.

> PATCH 1 adds a new block block device driver 'zoned_host_device', and
> PATCH 9 exposes it in QAPI.  This is for passing through a zoned host
> device, correct?

Yes! It allows the guest os see zoned host device. It is still in
development. Maybe the implementations will change later.


Best regards,
Sam
Markus Armbruster July 18, 2022, 10:53 a.m. UTC | #3
Sam Li <faithilikerun@gmail.com> writes:

> Markus Armbruster <armbru@redhat.com> 于2022年7月12日周二 13:47写道:
>>
>> Sam Li <faithilikerun@gmail.com> writes:
>>
>> > This patch series adds support for zoned device to virtio-blk emulation. Zoned
>> > Storage can support sequential writes, which reduces write amplification in SSD,
>> > leading to higher write throughput and increased capacity.
>>
>> Forgive me if this has already been discussed, or is explained deeper in
>> the patch series...
>>
>> The commit message sounds like you're extending virtio-blk to optionally
>> emulate zoned storage.  Correct?
>
> Yes! The main purpose is to emulate zoned storage only for the zoned
> device files. Right now, QEMU sees those as regular block devices.
>
>> PATCH 1 adds a new block block device driver 'zoned_host_device', and
>> PATCH 9 exposes it in QAPI.  This is for passing through a zoned host
>> device, correct?
>
> Yes! It allows the guest os see zoned host device. It is still in
> development. Maybe the implementations will change later.

Your cover letter only mentions the virtio-blk part, not the
pass-through part.  Please correct that if you need to respin.
Stefan Hajnoczi July 27, 2022, 2:55 p.m. UTC | #4
On Mon, 11 Jul 2022 at 22:17, Sam Li <faithilikerun@gmail.com> wrote:
>
> This patch series adds support for zoned device to virtio-blk emulation. Zoned
> Storage can support sequential writes, which reduces write amplification in SSD,
> leading to higher write throughput and increased capacity.

Please use "git rebase -i master" and add "x make" lines after each
commit to check that the code still builds after each commit. It is
important to order patches so that each commit still builds
successfully. That way git-bisect(1) works and patches can be
backported/cherry-picked.

Stefan
Stefan Hajnoczi July 27, 2022, 3:06 p.m. UTC | #5
This patch series introduces the concept of zoned storage to the QEMU
block layer. Documentation is needed so that users and developers know
how to use and maintain this feature.

As a minimum, let's document how to pass through zoned block devices on Linux:

diff --git a/docs/system/qemu-block-drivers.rst.inc
b/docs/system/qemu-block-drivers.rst.inc
index dfe5d2293d..f6ba05710a 100644
--- a/docs/system/qemu-block-drivers.rst.inc
+++ b/docs/system/qemu-block-drivers.rst.inc
@@ -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 be 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
 ^^^^^^^

For developers there should be an explanation of the zoned storage
APIs and how BlockDrivers declare support. It should also mention the
status of pass through (implemented in the zoned_host_device driver)
vs zone emulation (not implemented in the QEMU block layer) so
developers understand the block layer's zoned storage capabilities.
You can add a docs/devel/zoned-storage.rst file to document this or
let me know if you want me to write it.

Stefan
Sam Li July 27, 2022, 3:14 p.m. UTC | #6
Stefan Hajnoczi <stefanha@gmail.com> 于2022年7月27日周三 23:06写道:
>
> This patch series introduces the concept of zoned storage to the QEMU
> block layer. Documentation is needed so that users and developers know
> how to use and maintain this feature.
>
> As a minimum, let's document how to pass through zoned block devices on Linux:
>
> diff --git a/docs/system/qemu-block-drivers.rst.inc
> b/docs/system/qemu-block-drivers.rst.inc
> index dfe5d2293d..f6ba05710a 100644
> --- a/docs/system/qemu-block-drivers.rst.inc
> +++ b/docs/system/qemu-block-drivers.rst.inc
> @@ -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 be 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
>  ^^^^^^^
>
> For developers there should be an explanation of the zoned storage
> APIs and how BlockDrivers declare support. It should also mention the
> status of pass through (implemented in the zoned_host_device driver)
> vs zone emulation (not implemented in the QEMU block layer) so
> developers understand the block layer's zoned storage capabilities.
> You can add a docs/devel/zoned-storage.rst file to document this or
> let me know if you want me to write it.

I will write the document and address the issues in the reviews, which
should be in the next revision.
Thanks for reviewing!

Have a good day!
Sam