qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 05/20] qemu-img: Call blk_set_enable_write_cache


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 05/20] qemu-img: Call blk_set_enable_write_cache() explicitly
Date: Sat, 26 Mar 2016 18:54:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0

On 18.03.2016 19:21, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  qemu-img.c | 79 
> ++++++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 48 insertions(+), 31 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 839e05b..96b51d4 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c

[...]

> @@ -2862,26 +2874,30 @@ static int img_rebase(int argc, char **argv)
>      qemu_progress_print(0, 100);
>  
>      flags = BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0);
> -    ret = bdrv_parse_cache_flags(cache, &flags);
> +    ret = bdrv_parse_cache_mode(cache, &flags, &writethrough);
>      if (ret < 0) {
>          error_report("Invalid cache option: %s", cache);
>          goto out;
>      }
>  
> -    src_flags = BDRV_O_CACHE_WB;
> -    ret = bdrv_parse_cache_flags(src_cache, &src_flags);
> +    src_flags = 0;
> +    ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
>      if (ret < 0) {
>          error_report("Invalid source cache option: %s", src_cache);
>          goto out;
>      }
>  
> +    /* The source files are opened read-only, don't care about WCE */
> +    assert((src_writethrough & BDRV_O_RDWR) == 0);

Well, yeah, that is a trivial assertion to make because BDRV_O_RDWR is 2.

I guess you meant s/src_writethrough/src_flags/.

With that fixed:

Reviewed-by: Max Reitz <address@hidden>

> +    (void) src_writethrough;
> +
>      /*
>       * Open the images.
>       *
>       * Ignore the old backing file for unsafe rebase in case we want to 
> correct
>       * the reference to a renamed or moved backing file.
>       */
> -    blk = img_open(image_opts, filename, fmt, flags, true, quiet);
> +    blk = img_open(image_opts, filename, fmt, flags, true, writethrough, 
> quiet);
>      if (!blk) {
>          ret = -1;
>          goto out;

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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