From: Sam Li <faithilikerun@gmail.com>
To: qemu-devel@nongnu.org
Cc: damien.lemoal@opensource.wdc.com, dmitry.fomichev@wdc.com,
hare@suse.de, stefanha@redhat.com, mst@redhat.com,
armbru@redhat.com, qemu-block@nongnu.org, fam@euphon.net,
kwolf@redhat.com, hreitz@redhat.com, eblake@redhat.com,
Sam Li <faithilikerun@gmail.com>
Subject: [RFC v5 00/11] Add support for zoned device
Date: Mon, 1 Aug 2022 09:20:15 +0800 [thread overview]
Message-ID: <20220801012015.4902-1-faithilikerun@gmail.com> (raw)
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
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. 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.
This patch series extend 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).
It can be tested on a null_blk device using qemu-io, qemu-iotests or blkzone(8)
command in the guest os. 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
v5:
- add zoned storage emulation to virtio-blk device
- add documentation for zoned storage
- address review comments
* fix qemu-iotests
* fix check to block layer
* modify interfaces of sysfs helper functions
* rename zoned device structs according to QEMU styles
* reorder patches
v4:
- add virtio-blk headers for zoned device
- add configurations for zoned host device
- add zone operations for raw-format
- address review comments
* fix memory leak bug in zone_report
* add checks to block layers
* fix qemu-iotests format
* fix sysfs helper functions
v3:
- add helper functions to get sysfs attributes
- address review comments
* fix zone report bugs
* fix the qemu-io code path
* use thread pool to avoid blocking ioctl() calls
v2:
- add qemu-io sub-commands
- address review comments
* modify interfaces of APIs
v1:
- add block layer APIs resembling Linux ZoneBlockDevice ioctls
Sam Li (11):
include: add zoned device structs
include: import virtio_blk headers from linux with zoned storage
support
file-posix: introduce get_sysfs_long_val for the long sysfs attribute
file-posix: introduce get_sysfs_str_val for device zoned model
block: add block layer APIs resembling Linux ZonedBlockDevice ioctls
raw-format: add zone operations to pass through requests
config: add check to block layer
virtio-blk: add zoned storage APIs for zoned devices
qemu-io: add zoned block device operations.
qemu-iotests: test new zone operations
docs/zoned-storage: add zoned device documentation
block.c | 13 +
block/block-backend.c | 139 +++++++
block/coroutines.h | 6 +
block/file-posix.c | 383 +++++++++++++++++++-
block/io.c | 41 +++
block/raw-format.c | 14 +
docs/devel/zoned-storage.rst | 68 ++++
docs/system/qemu-block-drivers.rst.inc | 6 +
hw/block/virtio-blk.c | 172 ++++++++-
include/block/block-common.h | 44 ++-
include/block/block-io.h | 13 +
include/block/block_int-common.h | 35 +-
include/block/raw-aio.h | 6 +-
include/standard-headers/linux/virtio_blk.h | 118 ++++++
include/sysemu/block-backend-io.h | 6 +
meson.build | 1 +
qapi/block-core.json | 7 +-
qemu-io-cmds.c | 144 ++++++++
tests/qemu-iotests/tests/zoned.out | 53 +++
tests/qemu-iotests/tests/zoned.sh | 86 +++++
20 files changed, 1340 insertions(+), 15 deletions(-)
create mode 100644 docs/devel/zoned-storage.rst
create mode 100644 tests/qemu-iotests/tests/zoned.out
create mode 100755 tests/qemu-iotests/tests/zoned.sh
--
2.37.1
next reply other threads:[~2022-08-01 1:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 1:20 Sam Li [this message]
2022-08-01 16:16 ` [RFC v5 00/11] Add support for zoned device Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220801012015.4902-1-faithilikerun@gmail.com \
--to=faithilikerun@gmail.com \
--cc=armbru@redhat.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dmitry.fomichev@wdc.com \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=hare@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).