From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img: refuse to compress files with invalid size
Date: Fri, 12 Apr 2013 21:55:14 +0200 [thread overview]
Message-ID: <20130412195513.GA4510@irqsave.net> (raw)
In-Reply-To: <1365788268-24787-1-git-send-email-stefanha@redhat.com>
Le Friday 12 Apr 2013 à 19:37:48 (+0200), Stefan Hajnoczi a écrit :
> Image file compression works at cluster granularity. It is not possible
> to compress less than a cluster of data at a time.
>
> Print an error when attempting qemu-img convert -c with an input file
> that is not a multiple of the cluster size.
>
> I considered automatically adjusting the output file size but think it's
> better to be explicit. This avoids confusion when users notice that
> image file size changed after conversion.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> qemu-img.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 31627b0..2273851 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1370,6 +1370,13 @@ static int img_convert(int argc, char **argv)
> goto out;
> }
> cluster_sectors = cluster_size >> 9;
> + if (total_sectors % cluster_sectors) {
> + error_report("compression requires that input file size is a "
> + "multiple of %d bytes",
> + cluster_size);
> + ret = -1;
> + goto out;
> + }
> sector_num = 0;
>
> nb_sectors = total_sectors;
> --
> 1.8.1.4
>
>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
next prev parent reply other threads:[~2013-04-12 19:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-12 17:37 [Qemu-devel] [PATCH] qemu-img: refuse to compress files with invalid size Stefan Hajnoczi
2013-04-12 19:55 ` Benoît Canet [this message]
2013-04-12 20:04 ` Eric Blake
2013-04-15 6:53 ` Stefan Hajnoczi
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=20130412195513.GA4510@irqsave.net \
--to=benoit.canet@irqsave.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.