On Sun, 31 Jul 2022 at 21:42, Sam Li <faithilike...@gmail.com> wrote:
>
> Add 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 driver=zoned_host_device, filename=/dev/nullb0
> -c "zrp offset nr_zones"
>
> Signed-off-by: Sam Li <faithilike...@gmail.com>
> ---
>  block/io.c     |  24 ++-------
>  qemu-io-cmds.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 148 insertions(+), 20 deletions(-)
>
> diff --git a/block/io.c b/block/io.c
> index a4625fb0e1..de9ec1d740 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -3209,19 +3209,11 @@ int bdrv_co_zone_report(BlockDriverState *bs, int64_t 
> offset,
>      IO_CODE();
>
>      bdrv_inc_in_flight(bs);
> -    if (!drv || (!drv->bdrv_co_zone_report)) {
> +    if (!drv || !drv->bdrv_co_zone_report) {
>          co.ret = -ENOTSUP;
>          goto out;
>      }
> -
> -    if (drv->bdrv_co_zone_report) {
> -        co.ret = drv->bdrv_co_zone_report(bs, offset, nr_zones, zones);
> -    } else {
> -        co.ret = -ENOTSUP;
> -        goto out;
> -        qemu_coroutine_yield();
> -    }
> -
> +    co.ret = drv->bdrv_co_zone_report(bs, offset, nr_zones, zones);
>  out:
>      bdrv_dec_in_flight(bs);
>      return co.ret;
> @@ -3237,19 +3229,11 @@ int bdrv_co_zone_mgmt(BlockDriverState *bs, 
> BlockZoneOp op,
>      IO_CODE();
>
>      bdrv_inc_in_flight(bs);
> -    if (!drv || (!drv->bdrv_co_zone_mgmt)) {
> +    if (!drv || !drv->bdrv_co_zone_mgmt) {
>          co.ret = -ENOTSUP;
>          goto out;
>      }
> -
> -    if (drv->bdrv_co_zone_mgmt) {
> -        co.ret = drv->bdrv_co_zone_mgmt(bs, op, offset, len);
> -    } else {
> -        co.ret = -ENOTSUP;
> -        goto out;
> -        qemu_coroutine_yield();
> -    }
> -
> +    co.ret = drv->bdrv_co_zone_mgmt(bs, op, offset, len);
>  out:
>      bdrv_dec_in_flight(bs);
>      return co.ret;

Please squash these changes into the earlier patch that introduced
these functions.

Otherwise:

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Reply via email to