qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2 v2] block: flush backing_hd in the right pla


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 1/2 v2] block: flush backing_hd in the right place
Date: Wed, 13 Jan 2010 10:50:50 +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 19:13, 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.
> 
> Also flush the frontend image if we have a make_empty method that
> possibly writes to it.
> 
> Signed-off-by: Christoph Hellwig <address@hidden>
> 
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c 2010-01-12 19:08:07.363003775 +0100
> +++ qemu/block.c      2010-01-12 19:09:10.836255948 +0100
> @@ -589,6 +589,7 @@ int bdrv_commit(BlockDriverState *bs)
>      BlockDriver *drv = bs->drv;
>      int64_t i, total_sectors;
>      int n, j;
> +    int ret = 0;
>      unsigned char sector[512];
>  
>      if (!drv)
> @@ -620,10 +621,18 @@ int bdrv_commit(BlockDriverState *bs)
>          }
>      }
>  
> -    if (drv->bdrv_make_empty)
> -     return drv->bdrv_make_empty(bs);
> +    if (drv->bdrv_make_empty) {
> +     ret = drv->bdrv_make_empty(bs);
> +        bdrv_flush(bs);
> +    }

Indentation is off here (but it already was before the patch). The logic
looks good to me now.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]