From: Stefan Hajnoczi <stefanha@gmail.com>
To: Changpeng Liu <changpeng.liu@intel.com>
Cc: qemu-devel@nongnu.org, sgazare@redhat.com, stefanha@redhat.com,
mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 3/3] vhost-user-blk: add discard/write zeroes features support
Date: Wed, 16 Jan 2019 14:26:40 +0000 [thread overview]
Message-ID: <20190116142640.GD16898@stefanha-x1.localdomain> (raw)
In-Reply-To: <1547615970-23545-3-git-send-email-changpeng.liu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
On Wed, Jan 16, 2019 at 01:19:30PM +0800, Changpeng Liu wrote:
> @@ -161,6 +175,44 @@ vub_writev(VubReq *req, struct iovec *iov, uint32_t iovcnt)
> return rc;
> }
>
> +static int
> +vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt,
> + uint32_t type)
> +{
> + struct virtio_blk_discard_write_zeroes *desc;
> + ssize_t size;
> + void *buf;
> +
> + size = vub_iov_size(iov, iovcnt);
> + if (size != sizeof(*desc)) {
> + fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*desc));
> + return -1;
> + }
> + buf = g_new0(char, size);
> + vub_iov_to_buf(iov, iovcnt, buf);
It's simpler without g_new0():
struct virtio_blk_discard_write_zeroes desc;
ssize_t size;
size = vub_iov_size(iov, iovcnt);
if (size != sizeof(desc)) {
fprintf(stderr, "Invalid size %zd, expected %zu\n", size, sizeof(desc));
return -1;
}
vub_iov_to_buf(iov, iovcnt, &desc);
...
Other than that:
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2019-01-16 14:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 5:19 [Qemu-devel] [PATCH v2 1/3] contrib: compile vhost-user-blk tool by default Changpeng Liu
2019-01-16 5:19 ` [Qemu-devel] [PATCH v2 2/3] contrib/vhost-user-blk: fix the compilation issue Changpeng Liu
2019-01-16 14:26 ` Stefan Hajnoczi
2019-01-17 11:49 ` Stefano Garzarella
2019-01-16 5:19 ` [Qemu-devel] [PATCH v2 3/3] vhost-user-blk: add discard/write zeroes features support Changpeng Liu
2019-01-16 14:26 ` Stefan Hajnoczi [this message]
2019-01-16 14:26 ` [Qemu-devel] [PATCH v2 1/3] contrib: compile vhost-user-blk tool by default Stefan Hajnoczi
2019-01-17 11:47 ` Stefano Garzarella
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=20190116142640.GD16898@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=changpeng.liu@intel.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgazare@redhat.com \
--cc=stefanha@redhat.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).