[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] block: flush backing_hd in the right place
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] block: flush backing_hd in the right place |
Date: |
Tue, 12 Jan 2010 18:42:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-3.fc11 Thunderbird/3.0 |
Am 12.01.2010 13:49, schrieb Christoph Hellwig:
>
> 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 <address@hidden>
>
> 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;
> }
Format drivers with a bdrv_make_empty return before the flush, so it
won't work for qcow1. Looks good otherwise.
If it has done a bdrv_make_empty we might also want to flush bs?
Kevin