From: Frediano Ziglio <freddy77@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 5/5] qemu_aio_get used to clear all allocated buffer
Date: Wed, 20 Jul 2011 15:45:34 +0200 [thread overview]
Message-ID: <CAHt6W4cat9Z6zFHV-+yJZ_weMaosZtO8XWSpHTtY52qPf2eenA@mail.gmail.com> (raw)
In-Reply-To: <4E26D2B6.6050006@redhat.com>
2011/7/20 Kevin Wolf <kwolf@redhat.com>:
> Am 20.07.2011 09:57, schrieb Frediano Ziglio:
>> Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
>> ---
>> block/qcow.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/block/qcow.c b/block/qcow.c
>> index 007fb57..8fd1ee5 100644
>> --- a/block/qcow.c
>> +++ b/block/qcow.c
>> @@ -499,7 +499,6 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
>> int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
>> int is_write, QCowAIOCB *acb)
>> {
>> - memset(acb, 0, sizeof(*acb));
>> acb->bs = bs;
>> acb->sector_num = sector_num;
>> acb->qiov = qiov;
>> @@ -509,6 +508,7 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
>> if (is_write)
>> qemu_iovec_to_buffer(qiov, acb->buf);
>> } else {
>> + acb->orig_buf = NULL;
>> acb->buf = (uint8_t *)qiov->iov->iov_base;
>> }
>> acb->nb_sectors = nb_sectors;
>
> What does this fix? Removing the memset looks like changing code for no
> obvious reason. Is there any state in acb that must survive qcow_aio_setup?
>
> Kevin
>
No, this is not a fix, just an optimization, memset was used to clear
entire structure but all fields are set by qcow_aio_setup, only
orig_buf left.
The comment, I must admit is terrible! And it's mine! I'll rewrite all
comments, perhaps merge some commits and send all patches again.
Frediano
next prev parent reply other threads:[~2011-07-20 13:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 7:56 [Qemu-devel] [RFC PATCH 0/5] Coroutines cleanup Frediano Ziglio
2011-07-20 7:57 ` [Qemu-devel] [RFC PATCH 1/5] allocate AIO on stack Frediano Ziglio
2011-07-20 7:57 ` [Qemu-devel] [RFC PATCH 2/5] use more stack Frediano Ziglio
2011-07-20 7:57 ` [Qemu-devel] [RFC PATCH 3/5] more stack work Frediano Ziglio
2011-07-20 7:57 ` [Qemu-devel] [RFC PATCH 4/5] avoid dandling pointers Frediano Ziglio
2011-07-20 7:57 ` [Qemu-devel] [RFC PATCH 5/5] qemu_aio_get used to clear all allocated buffer Frediano Ziglio
2011-07-20 13:05 ` Kevin Wolf
2011-07-20 13:45 ` Frediano Ziglio [this message]
2011-07-20 13:03 ` [Qemu-devel] [RFC PATCH 0/5] Coroutines cleanup Kevin Wolf
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=CAHt6W4cat9Z6zFHV-+yJZ_weMaosZtO8XWSpHTtY52qPf2eenA@mail.gmail.com \
--to=freddy77@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).