[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: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue |
Date: |
Fri, 21 Feb 2020 11:31:18 +0000 |
On Thu, Feb 13, 2020 at 09:28:07AM +0800, address@hidden wrote:
> 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);
Minor point, up to you if you want to change it: the array is fully
initialized by the for loop in the next line. There is no need to clear
the memory first:
s/g_new0/g_new/
> 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;
Both vqs and virtqs exist and are easily confused. Please rename vqs to
vhost_vqs.
signature.asc
Description: PGP signature