qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Frediano Ziglio <freddy77@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 2/5] qcow: QCowAIOCB field cleanup
Date: Fri, 22 Jul 2011 09:01:38 +0200	[thread overview]
Message-ID: <4E292052.3000407@redhat.com> (raw)
In-Reply-To: <1311170189-29734-3-git-send-email-freddy77@gmail.com>

Am 20.07.2011 15:56, schrieb Frediano Ziglio:
> remove unused field from this structure and put some of them in qcow_aio_read_cb and qcow_aio_write_cb
> 
> Signed-off-by: Frediano Ziglio <freddy77@gmail.com>

>          qemu_co_mutex_lock(&s->lock);
>          if (ret < 0) {
>              return ret;
>          }
>      }
>  
> -    return 1;
> +    goto redo;
>  }
>  
>  static int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
> @@ -623,9 +612,7 @@ static int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
>      qcow_aio_setup(bs, sector_num, qiov, nb_sectors, 0, &acb);
>  
>      qemu_co_mutex_lock(&s->lock);
> -    do {
> -        ret = qcow_aio_read_cb(&acb);
> -    } while (ret > 0);
> +    ret = qcow_aio_read_cb(&acb);
>      qemu_co_mutex_unlock(&s->lock);
>  
>      if (acb.qiov->niov > 1) {

What was wrong with the loop and return 1?

I think the old state was closer to what it should look like:
qcow_aio_read_cb should become a function that reads as much as it can
from a given offset to a given pointer and returns how much that was.
qcow_co_readv should contain the loop that calls it with the right
parameters.

Kevin

  reply	other threads:[~2011-07-22  6:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 13:56 [Qemu-devel] [RFC PATCH 0/5] qcow: coroutines cleanup Frediano Ziglio
2011-07-20 13:56 ` [Qemu-devel] [RFC PATCH 1/5] qcow: allocate QCowAIOCB structure using stack Frediano Ziglio
2011-07-20 13:56 ` [Qemu-devel] [RFC PATCH 2/5] qcow: QCowAIOCB field cleanup Frediano Ziglio
2011-07-22  7:01   ` Kevin Wolf [this message]
2011-07-20 13:56 ` [Qemu-devel] [RFC PATCH 3/5] qcow: move some blocks of code to avoid useless variable initialization Frediano Ziglio
2011-07-20 13:56 ` [Qemu-devel] [RFC PATCH 4/5] avoid dandling pointers Frediano Ziglio
2011-07-22  7:02   ` Kevin Wolf
2011-07-22  9:29     ` Frediano Ziglio
2011-07-20 13:56 ` [Qemu-devel] [RFC PATCH 5/5] qcow: small optimization initializing QCowAIOCB Frediano Ziglio
2011-07-22  7:04 ` [Qemu-devel] [RFC PATCH 0/5] qcow: coroutines cleanup Kevin Wolf
2011-07-22  9:26   ` Frediano Ziglio
2011-07-22 10:10     ` Kevin Wolf
2011-07-22 11:00       ` Stefan Hajnoczi
2011-07-22 13:24         ` Frediano Ziglio
2011-07-22 13:39           ` Kevin Wolf
2011-07-22 13:48           ` Gerd Hoffmann
2011-07-22 20:09       ` Frediano Ziglio
2011-07-25  7:53         ` 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=4E292052.3000407@redhat.com \
    --to=kwolf@redhat.com \
    --cc=freddy77@gmail.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).