qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: phoeagon <phoeagon@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c for metadata updates
Date: Wed, 06 May 2015 18:42:00 +0200	[thread overview]
Message-ID: <554A4458.7090901@redhat.com> (raw)
In-Reply-To: <CAKYApDDeMtGm8jUCJVNXzj6owZPPKKcQboCMdMS_kTzOzWXOQg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2256 bytes --]

@subject: It's a bit long, and it's missing a prefix telling what this 
patch is about. I would have probably used "block/vdi: Use bdrv_flush 
after metadata updates" or something like that.

On 01.05.2015 17:03, phoeagon wrote:
> Looks like VDI is the only writable image format that does not use 
> write-with-barrier(sync) when updating the metadata. A sequence of 
> commits b0ad5a455d~078a458e077d6b0db2 fixes this for 
> QCOW/COW/QCOW2/VPC/VMDK, but the VDI does not issue a barrier by sync 
> after updating the metadata.
>
> This commit adds a `bdrv_flush` after updating block map.
>
>
> Signed-off-by: Zhe Qiu <address@hidden>

Hm, this doesn't look quite right. :-)

> ---------------

These should be only "---", I guess, so the block below is omitted from 
the commit message.

> From 2ea36d9a0e676b534483dc54c191f421f9889dc6 Mon Sep 17 00:00:00 2001
> From: phoeagon <address@hidden>
> Date: Fri, 1 May 2015 19:00:22 +0800
> Subject: [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c
>
> In reference to 
> b0ad5a455d7e5352d4c86ba945112011dbeadfb8~078a458e077d6b0db262c4b05fee51d01de2d1d2, 
> metadata writes to qcow2/cow/qcow/vpc/vmdk are all synced prior to 
> succeeding writes.
> ---
>  block/vdi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/block/vdi.c b/block/vdi.c
> index 7642ef3..5d09b36 100644
> --- a/block/vdi.c
> +++ b/block/vdi.c
> @@ -713,6 +713,7 @@ static int vdi_co_write(BlockDriverState *bs,
>          logout("will write %u block map sectors starting from entry 
> %u\n",
>                 n_sectors, bmap_first);
>          ret = bdrv_write(bs->file, offset, base, n_sectors);
> +        ret = bdrv_flush(bs->file);

This overwrites the return value from bdrv_write(), which I don't think 
is right. We could either ignore bdrv_flush()'s return value, or make it 
something like "if (ret < 0) { bdrv_flush(bs->file); } else { ret = 
bdrv_flush(bs->file); }" or "ret_flush = bdrv_flush(bs->file); if (!(ret 
< 0)) { ret = ret_flush; }". Or skip the flush in case bdrv_write() 
failed ("if (ret < 0) { return ret; } ret = bdrv_flush(bs->file);"), 
like bdrv_pwrite_sync() does.

The idea of the change (adding the flush) looks good, though.

Max

>      }
>      return ret;
> -- 
> 2.3.7
>


[-- Attachment #2: Type: text/html, Size: 4446 bytes --]

  reply	other threads:[~2015-05-06 16:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 15:03 [Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c for metadata updates phoeagon
2015-05-06 16:42 ` Max Reitz [this message]
2015-05-06 17:23   ` phoeagon
2015-05-06 17:28     ` Eric Blake
2015-05-06 17:36     ` Max Reitz

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=554A4458.7090901@redhat.com \
    --to=mreitz@redhat.com \
    --cc=phoeagon@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).