From: Jeff Cody <jcody@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, gentoo.integer@gmail.com,
qemu-devel@nongnu.org, stefanha@redhat.com
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 [thread overview]
Message-ID: <20131113152314.GA22807@localhost.localdomain> (raw)
In-Reply-To: <1384303994-26796-2-git-send-email-famz@redhat.com>
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 <famz@redhat.com>
> ---
> 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
next prev parent reply other threads:[~2013-11-13 15:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 0:53 [Qemu-devel] [PATCH 0/5] Fix conversion from ISO to VMDK streamOptimized Fam Zheng
2013-11-13 0:53 ` [Qemu-devel] [PATCH 1/5] qemu-img: Convert by cluster size if target is compressed Fam Zheng
2013-11-13 15:23 ` Jeff Cody [this message]
2013-11-14 1:18 ` Fam Zheng
2013-11-14 1:34 ` Jeff Cody
2013-11-14 1:49 ` Fam Zheng
2013-11-13 0:53 ` [Qemu-devel] [PATCH 2/5] vmdk: Implement .bdrv_write_compressed Fam Zheng
2013-11-13 0:53 ` [Qemu-devel] [PATCH 3/5] block: Change BlockDriverInfo.cluster_size to 64 bits Fam Zheng
2013-11-13 0:53 ` [Qemu-devel] [PATCH 4/5] vmdk: Implement .bdrv_get_info() Fam Zheng
2013-11-13 0:53 ` [Qemu-devel] [PATCH 5/5] mirror: Check for bdrv_get_info result Fam Zheng
2013-11-13 15:34 ` Jeff Cody
2013-11-14 1:26 ` Fam Zheng
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=20131113152314.GA22807@localhost.localdomain \
--to=jcody@redhat.com \
--cc=famz@redhat.com \
--cc=gentoo.integer@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).