mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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>
This commit is contained in:
parent
a735b56e49
commit
6d43eaa396
9 changed files with 696 additions and 3 deletions
|
@ -713,6 +713,12 @@ struct BlockDriver {
|
|||
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_load_vmstate)(
|
||||
BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
|
||||
|
||||
int coroutine_fn (*bdrv_co_zone_report)(BlockDriverState *bs,
|
||||
int64_t offset, unsigned int *nr_zones,
|
||||
BlockZoneDescriptor *zones);
|
||||
int coroutine_fn (*bdrv_co_zone_mgmt)(BlockDriverState *bs, BlockZoneOp op,
|
||||
int64_t offset, int64_t len);
|
||||
|
||||
/* removable device specific */
|
||||
bool coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_is_inserted)(
|
||||
BlockDriverState *bs);
|
||||
|
@ -865,6 +871,21 @@ typedef struct BlockLimits {
|
|||
|
||||
/* device zone model */
|
||||
BlockZoneModel zoned;
|
||||
|
||||
/* zone size expressed in bytes */
|
||||
uint32_t zone_size;
|
||||
|
||||
/* total number of zones */
|
||||
uint32_t nr_zones;
|
||||
|
||||
/* maximum sectors of a zone append write operation */
|
||||
uint32_t max_append_sectors;
|
||||
|
||||
/* maximum number of open zones */
|
||||
uint32_t max_open_zones;
|
||||
|
||||
/* maximum number of active zones */
|
||||
uint32_t max_active_zones;
|
||||
} BlockLimits;
|
||||
|
||||
typedef struct BdrvOpBlocker BdrvOpBlocker;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue