qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] block: flush backing_hd in the right place
Date: Wed, 13 Jan 2010 17:26:48 -0600	[thread overview]
Message-ID: <4B4E56B8.6000701@codemonkey.ws> (raw)
In-Reply-To: <20100112124923.GA19631@lst.de>

On 01/12/2010 06:49 AM, Christoph Hellwig wrote:
> The backing device is only modified from bdrv_commit.  So instead of
> flushing it every time bdrv_flush is called for the front-end device
> only flush it after we're written data to it in bdrv_commit.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c	2010-01-12 11:34:35.549024986 +0100
> +++ qemu/block.c	2010-01-12 11:43:28.965006129 +0100
> @@ -623,6 +623,12 @@ int bdrv_commit(BlockDriverState *bs)
>       if (drv->bdrv_make_empty)
>   	return drv->bdrv_make_empty(bs);
>
> +    /*
> +     * Make sure all data we wrote to the backing device is actually
> +     * stable on disk.
> +     */
> +    if (bs->backing_hd)
> +        bdrv_flush(bs->backing_hd);
>       return 0;
>   }
>
> @@ -1124,12 +1130,8 @@ const char *bdrv_get_device_name(BlockDr
>
>   void bdrv_flush(BlockDriverState *bs)
>   {
> -    if (!bs->drv)
> -        return;
> -    if (bs->drv->bdrv_flush)
> +    if (bs->drv&&  bs->drv->bdrv_flush)
>           bs->drv->bdrv_flush(bs);
> -    if (bs->backing_hd)
> -        bdrv_flush(bs->backing_hd);
>   }
>
>   void bdrv_flush_all(void)
> @@ -1806,11 +1808,6 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDr
>
>       if (!drv)
>           return NULL;
> -
> -    /*
> -     * Note that unlike bdrv_flush the driver is reponsible for flushing a
> -     * backing image if it exists.
> -     */
>       return drv->bdrv_aio_flush(bs, cb, opaque);
>   }
>
>
>
>
>    

  parent reply	other threads:[~2010-01-13 23:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 12:49 [Qemu-devel] [PATCH 1/2] block: flush backing_hd in the right place Christoph Hellwig
2010-01-12 17:42 ` Kevin Wolf
2010-01-12 17:44   ` Christoph Hellwig
2010-01-12 18:13 ` [Qemu-devel] [PATCH 1/2 v2] " Christoph Hellwig
2010-01-13  9:50   ` Kevin Wolf
2010-01-13 23:26 ` Anthony Liguori [this message]
2010-01-14 10:21   ` [Qemu-devel] [PATCH 1/2] " Kevin Wolf
2010-01-17 11:32     ` [Qemu-devel] [PATCH] block: fix cache flushing in bdrv_commit Christoph Hellwig
2010-01-20 14:58       ` Anthony Liguori

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=4B4E56B8.6000701@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=hch@lst.de \
    --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).