qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: pannengyuan@huawei.com
Cc: kwolf@redhat.com, zhang.zhanghailiang@huawei.com,
	qemu-block@nongnu.org, mst@redhat.com, qemu-devel@nongnu.org,
	mreitz@redhat.com
Subject: Re: [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue
Date: Fri, 21 Feb 2020 11:31:18 +0000	[thread overview]
Message-ID: <20200221113118.GG1484511@stefanha-x1.localdomain> (raw)
In-Reply-To: <20200213012807.45552-3-pannengyuan@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

On Thu, Feb 13, 2020 at 09:28:07AM +0800, pannengyuan@huawei.com 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-02-21 11:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  1:28 [PATCH 0/2] delete virtio queues in vhost-user-blk-unrealize pannengyuan
2020-02-13  1:28 ` [PATCH 1/2] vhost-user-blk: delete virtioqueues in unrealize to fix memleaks pannengyuan
2020-02-21 11:32   ` Stefan Hajnoczi
2020-02-13  1:28 ` [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue pannengyuan
2020-02-21 11:31   ` Stefan Hajnoczi [this message]
2020-02-22  7:56     ` Pan Nengyuan
2020-02-25 13:31   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200221113118.GG1484511@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pannengyuan@huawei.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).