From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, quintela@redhat.com,
jcody@redhat.com, dgilbert@redhat.com, mreitz@redhat.com,
stefanha@redhat.com, den@openvz.org, jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 16/17] hw/ide: drop iov field from IDEBufferedRequest
Date: Thu, 7 Feb 2019 09:38:30 -0600 [thread overview]
Message-ID: <0ed554ed-12fb-81df-7175-ff623a6292a3@redhat.com> (raw)
In-Reply-To: <20190207102445.71998-17-vsementsov@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
On 2/7/19 4:24 AM, Vladimir Sementsov-Ogievskiy wrote:
> @iov is used only to initialize @qiov. Let's use new
> qemu_iovec_init_buf() instead, which simplifies the code.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> include/hw/ide/internal.h | 1 -
> hw/ide/core.c | 11 ++++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
> +++ b/hw/ide/core.c
> @@ -629,13 +629,15 @@ static void ide_buffered_readv_cb(void *opaque, int ret)
> IDEBufferedRequest *req = opaque;
> if (!req->orphaned) {
> if (!ret) {
> - qemu_iovec_from_buf(req->original_qiov, 0, req->iov.iov_base,
> + assert(req->qiov.size == req->original_qiov->size);
> + qemu_iovec_from_buf(req->original_qiov, 0,
> + req->qiov.local_iov.iov_base,
> req->original_qiov->size);
> }
> req->original_cb(req->original_opaque, ret);
> }
> QLIST_REMOVE(req, list);
> - qemu_vfree(req->iov.iov_base);
> + qemu_vfree(qemu_iovec_get_buf(&req->qiov));
Okay, I can see that freeing this variable in the callback needs some
way to get at the buffer that was allocated earlier from a different
function. Still, do we need qemu_iovec_get_buf(), or can we just
open-code it as qemu_vfree(req->qiov.local_iov.iov_base), since we
open-coded it in the qemu_iovec_from_buf() a few lines earlier?
> g_free(req);
> }
>
> @@ -660,9 +662,8 @@ BlockAIOCB *ide_buffered_readv(IDEState *s, int64_t sector_num,
> req->original_qiov = iov;
> req->original_cb = cb;
> req->original_opaque = opaque;
> - req->iov.iov_base = qemu_blockalign(blk_bs(s->blk), iov->size);
> - req->iov.iov_len = iov->size;
> - qemu_iovec_init_external(&req->qiov, &req->iov, 1);
> + qemu_iovec_init_buf(&req->qiov, blk_blockalign(s->blk, iov->size),
> + iov->size);
>
Took me longer to review this one, but looks like a correct conversion.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-02-07 15:38 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 10:24 [Qemu-devel] [PATCH v3 00/17] block: local qiov helper Vladimir Sementsov-Ogievskiy
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 01/17] block: enhance QEMUIOVector structure Vladimir Sementsov-Ogievskiy
2019-02-07 14:50 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 02/17] block/io: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-07 14:53 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 03/17] block/block-backend: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-07 14:54 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 04/17] block/backup: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-07 15:06 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 05/17] block/commit: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-07 15:07 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 06/17] block/stream: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:08 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 07/17] block/parallels: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:11 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 08/17] block/qcow: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-07 15:13 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 09/17] block/qcow2: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:15 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 10/17] block/qed: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:18 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 11/17] block/vmdk: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:19 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 12/17] qemu-img: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:20 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 13/17] migration/block: " Vladimir Sementsov-Ogievskiy
2019-02-07 15:20 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 14/17] tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-07 15:21 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 15/17] hw/ide: drop iov field from IDEState Vladimir Sementsov-Ogievskiy
2019-02-07 15:23 ` Eric Blake
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 16/17] hw/ide: drop iov field from IDEBufferedRequest Vladimir Sementsov-Ogievskiy
2019-02-07 15:38 ` Eric Blake [this message]
2019-02-07 10:24 ` [Qemu-devel] [PATCH v3 17/17] hw/ide: drop iov field from IDEDMA Vladimir Sementsov-Ogievskiy
2019-02-07 15:39 ` Eric Blake
2019-02-11 6:03 ` [Qemu-devel] [PATCH v3 00/17] block: local qiov helper Stefan Hajnoczi
2019-02-11 6:04 ` Stefan Hajnoczi
2019-02-12 17:41 ` Vladimir Sementsov-Ogievskiy
2019-02-13 7:52 ` Stefan Hajnoczi
2019-02-13 8:19 ` Stefan Hajnoczi
2019-02-18 10:24 ` Vladimir Sementsov-Ogievskiy
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=0ed554ed-12fb-81df-7175-ff623a6292a3@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).