qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/5] qemu-img: Convert by cluster size if target


From: Jeff Cody
Subject: Re: [Qemu-devel] [PATCH 1/5] qemu-img: Convert by cluster size if target is compressed
Date: Wed, 13 Nov 2013 10:23:15 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Nov 13, 2013 at 08:53:10AM +0800, Fam Zheng wrote:
> If target block driver forces compression, qemu-img convert needs to
> write by cluster size as well as "-c" option.
> 
> Particularly, this applies for converting to VMDK streamOptimized
> format.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  include/block/block.h | 1 +
>  qemu-img.c            | 5 ++++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/block/block.h b/include/block/block.h
> index 3560deb..169c092 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -18,6 +18,7 @@ typedef struct BlockDriverInfo {
>      /* offset at which the VM state can be saved (0 if not possible) */
>      int64_t vm_state_offset;
>      bool is_dirty;
> +    bool is_compressed;
>  } BlockDriverInfo;
>  
>  typedef struct BlockFragInfo {
> diff --git a/qemu-img.c b/qemu-img.c
> index bf3fb4f..09ed9b2 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1383,8 +1383,11 @@ static int img_convert(int argc, char **argv)
>          }
>      }
>  
> +    ret = bdrv_get_info(out_bs, &bdi);
> +    if (ret == 0) {
> +        compress = compress || bdi.is_compressed;
> +    }
>      if (compress) {
> -        ret = bdrv_get_info(out_bs, &bdi);
>          if (ret < 0) {
>              error_report("could not get block driver info");
>              goto out;

You need to move the error checking up as well, above the
'if (compress)'

Jeff




reply via email to

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