OSDN Git Service

block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls
authorSam Li <faithilikerun@gmail.com>
Mon, 8 May 2023 04:55:28 +0000 (12:55 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 15 May 2023 12:17:03 +0000 (08:17 -0400)
commit6d43eaa39647507563017590b090b2e2b10aed2d
tree5d59c499aaeecaa226010c25d84be010f1103661
parenta735b56e49be6f227f3f33be837a74c069441a48
block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls

Add zoned device option to host_device BlockDriver. It will be presented only
for zoned host block devices. By adding zone management operations to the
host_block_device BlockDriver, users can use the new block layer APIs
including Report Zone and four zone management operations
(open, close, finish, reset, reset_all).

Qemu-io uses the new APIs to perform zoned storage commands of the device:
zone_report(zrp), zone_open(zo), zone_close(zc), zone_reset(zrs),
zone_finish(zf).

For example, to test zone_report, use following command:
$ ./build/qemu-io --image-opts -n driver=host_device, filename=/dev/nullb0
-c "zrp offset nr_zones"

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-4-faithilikerun@gmail.com
Message-id: 20230324090605.28361-4-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org> and remove spurious ret = -errno in
raw_co_zone_mgmt().
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/block-backend.c
block/file-posix.c
block/io.c
include/block/block-io.h
include/block/block_int-common.h
include/block/raw-aio.h
include/sysemu/block-backend-io.h
meson.build
qemu-io-cmds.c