qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue


From: Michael S. Tsirkin
Subject: Re: [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue
Date: Tue, 25 Feb 2020 08:31:46 -0500

On Thu, Feb 13, 2020 at 09:28:07AM +0800, address@hidden wrote:
> From: Pan Nengyuan <address@hidden>
> 
> use the new virtio_delete_queue function to cleanup.
> 
> Signed-off-by: Pan Nengyuan <address@hidden>

typo in subject use-blk->user-blk


> ---
>  hw/block/vhost-user-blk.c          | 11 +++++++----
>  include/hw/virtio/vhost-user-blk.h |  1 +
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index 2eba8b9db0..ed6a5cc03b 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -420,9 +420,10 @@ static void vhost_user_blk_device_realize(DeviceState 
> *dev, Error **errp)
>      virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK,
>                  sizeof(struct virtio_blk_config));
>  
> +    s->virtqs = g_new0(VirtQueue *, s->num_queues);
>      for (i = 0; i < s->num_queues; i++) {
> -        virtio_add_queue(vdev, s->queue_size,
> -                         vhost_user_blk_handle_output);
> +        s->virtqs[i] = virtio_add_queue(vdev, s->queue_size,
> +                                        vhost_user_blk_handle_output);
>      }
>  
>      s->inflight = g_new0(struct vhost_inflight, 1);
> @@ -461,8 +462,9 @@ virtio_err:
>      g_free(s->vqs);
>      g_free(s->inflight);
>      for (i = 0; i < s->num_queues; i++) {
> -        virtio_del_queue(vdev, i);
> +        virtio_delete_queue(s->virtqs[i]);
>      }
> +    g_free(s->virtqs);
>      virtio_cleanup(vdev);
>      vhost_user_cleanup(&s->vhost_user);
>  }
> @@ -482,8 +484,9 @@ static void vhost_user_blk_device_unrealize(DeviceState 
> *dev, Error **errp)
>      g_free(s->inflight);
>  
>      for (i = 0; i < s->num_queues; i++) {
> -        virtio_del_queue(vdev, i);
> +        virtio_delete_queue(s->virtqs[i]);
>      }
> +    g_free(s->virtqs);
>      virtio_cleanup(vdev);
>      vhost_user_cleanup(&s->vhost_user);
>  }
> diff --git a/include/hw/virtio/vhost-user-blk.h 
> b/include/hw/virtio/vhost-user-blk.h
> index 108bfadeeb..f68911f6f0 100644
> --- a/include/hw/virtio/vhost-user-blk.h
> +++ b/include/hw/virtio/vhost-user-blk.h
> @@ -37,6 +37,7 @@ typedef struct VHostUserBlk {
>      struct vhost_inflight *inflight;
>      VhostUserState vhost_user;
>      struct vhost_virtqueue *vqs;
> +    VirtQueue **virtqs;
>      guint watch;
>      bool connected;
>  } VHostUserBlk;
> -- 
> 2.21.0.windows.1
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]