qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Fam Zheng <famcool@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents
Date: Sat, 18 Jun 2011 17:46:28 +0100	[thread overview]
Message-ID: <BANLkTik5ESgdiY6FbeH_b9Sg=6dfEK6W=g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=a6nba6R0J6q-KxVLLwGLFrEmM3w@mail.gmail.com>

On Sat, Jun 4, 2011 at 1:42 AM, Fam Zheng <famcool@gmail.com> wrote:
> Vmdk flush in extent array style.
>
>
> Signed-off-by: Fam Zheng <famcool@gmail.com>
> ---
>  block/vmdk.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index f1233cf..1d74b62 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1094,7 +1094,14 @@ static void vmdk_close(BlockDriverState *bs)
>
>  static int vmdk_flush(BlockDriverState *bs)
>  {
> -    return bdrv_flush(bs->file);
> +    int i, ret;
> +    BDRVVmdkState *s = bs->opaque;
> +
> +    ret = bdrv_flush(bs->file);
> +    for (i = 0; i < s->num_extents; i++) {
> +        ret |= bdrv_flush(s->extents[i].file);

This could produce an invalid return code (e.g. ORing together two
different errnos).

I think the best you can do is:
for (...) {
    ret = bdrv_flush(s->extents[i].file);
    if (ret < 0) {
        err = ret;
    }
}
return err;

This loses multiple errnos but it doesn't have the potential to corrupt them.

Stefan

      reply	other threads:[~2011-06-18 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04  0:42 [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents Fam Zheng
2011-06-18 16:46 ` Stefan Hajnoczi [this message]

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='BANLkTik5ESgdiY6FbeH_b9Sg=6dfEK6W=g@mail.gmail.com' \
    --to=stefanha@gmail.com \
    --cc=famcool@gmail.com \
    --cc=hch@lst.de \
    --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).