qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Czenczek <hreitz@redhat.com>
To: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, den@virtuozzo.com
Subject: Re: [PATCH 5/6] qemu-img: add compression option to rebase subcommand
Date: Fri, 25 Aug 2023 17:14:03 +0200	[thread overview]
Message-ID: <d6d14b11-fcf3-7306-c421-3fe7328dc47a@redhat.com> (raw)
In-Reply-To: <20230601192836.598602-6-andrey.drobyshev@virtuozzo.com>

On 01.06.23 21:28, Andrey Drobyshev via wrote:
> If we rebase an image whose backing file has compressed clusters, we
> might end up wasting disk space since the copied clusters are now
> uncompressed.  In order to have better control over this, let's add
> "--compress" option to the "qemu-img rebase" command.
>
> Note that this option affects only the clusters which are actually being
> copied from the original backing file.  The clusters which were
> uncompressed in the target image will remain so.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> ---
>   docs/tools/qemu-img.rst |  6 ++++--
>   qemu-img-cmds.hx        |  4 ++--
>   qemu-img.c              | 19 +++++++++++++++++--
>   3 files changed, 23 insertions(+), 6 deletions(-)

Interesting.  I was about to protest because we only really support 
writing compressed clusters to new and empty images, so the qcow2 driver 
does not allow overwriting existing clusters with compressed data.  But 
by design we skip all clusters that are anything but unallocated in the 
top image (i.e. the one we are going to write to), so this should indeed 
work out well.

Reviewed-by: Hanna Czenczek <hreitz@redhat.com>

> diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
> index 15aeddc6d8..973a912dec 100644
> --- a/docs/tools/qemu-img.rst
> +++ b/docs/tools/qemu-img.rst
> @@ -663,7 +663,7 @@ Command description:
>   
>     List, apply, create or delete snapshots in image *FILENAME*.
>   
> -.. option:: rebase [--object OBJECTDEF] [--image-opts] [-U] [-q] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-p] [-u] -b BACKING_FILE [-F BACKING_FMT] FILENAME
> +.. option:: rebase [--object OBJECTDEF] [--image-opts] [-U] [-q] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-p] [-u] [-c] -b BACKING_FILE [-F BACKING_FMT] FILENAME
>   
>     Changes the backing file of an image. Only the formats ``qcow2`` and
>     ``qed`` support changing the backing file.
> @@ -690,7 +690,9 @@ Command description:
>   
>       In order to achieve this, any clusters that differ between
>       *BACKING_FILE* and the old backing file of *FILENAME* are merged
> -    into *FILENAME* before actually changing the backing file.
> +    into *FILENAME* before actually changing the backing file. With ``-c``

“With the ``-c`` option specified, [...]”

> +    option specified, the clusters which are being merged (but not the
> +    entire *FILENAME* image) are written in the compressed mode.

“[...] are compressed when written.”

>       Note that the safe mode is an expensive operation, comparable to
>       converting an image. It only works if the old backing file still



  parent reply	other threads:[~2023-08-25 15:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 19:28 [PATCH 0/6] qemu-img: rebase: add compression support Andrey Drobyshev via
2023-06-01 19:28 ` [PATCH 1/6] qemu-img: rebase: stop when reaching EOF of old backing file Andrey Drobyshev via
2023-06-01 21:18   ` Michael Tokarev
2023-06-02 10:47     ` Andrey Drobyshev
2023-06-21 18:23   ` Denis V. Lunev
2023-08-25 14:29   ` Hanna Czenczek
2023-10-26  6:32   ` Michael Tokarev
2023-10-26  8:16     ` Andrey Drobyshev
2023-06-01 19:28 ` [PATCH 2/6] qemu-iotests: 024: add rebasing test case for overlay_size > backing_size Andrey Drobyshev via
2023-06-21 18:23   ` Denis V. Lunev
2023-08-25 14:29   ` Hanna Czenczek
2023-06-01 19:28 ` [PATCH 3/6] qemu-img: rebase: use backing files' BlockBackend for buffer alignment Andrey Drobyshev via
2023-06-21 18:16   ` Denis V. Lunev
2023-08-25 14:29   ` Hanna Czenczek
2023-08-29  7:06     ` Andrey Drobyshev
2023-08-29  8:44       ` Hanna Czenczek
2023-06-01 19:28 ` [PATCH 4/6] qemu-img: rebase: avoid unnecessary COW operations Andrey Drobyshev via
2023-06-21 18:53   ` Denis V. Lunev
2023-08-25 15:00   ` Hanna Czenczek
2023-08-29 13:27     ` Andrey Drobyshev
2023-06-01 19:28 ` [PATCH 5/6] qemu-img: add compression option to rebase subcommand Andrey Drobyshev via
2023-06-21 18:22   ` Denis V. Lunev
2023-08-25 15:14   ` Hanna Czenczek [this message]
2023-06-01 19:28 ` [PATCH 6/6] iotests: add test 314 for "qemu-img rebase" with compression Andrey Drobyshev via
2023-06-21 19:16   ` Denis V. Lunev
2023-08-25 15:17   ` Hanna Czenczek
2023-06-30 10:54 ` [PATCH 0/6] qemu-img: rebase: add compression support Denis V. Lunev
2023-07-07 11:33   ` Andrey Drobyshev
2023-07-24 13:11   ` Andrey Drobyshev
2023-07-31 14:43     ` Andrey Drobyshev
2023-08-16  9:22       ` Andrey Drobyshev
2023-08-22 17:35         ` Andrey Drobyshev

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=d6d14b11-fcf3-7306-c421-3fe7328dc47a@redhat.com \
    --to=hreitz@redhat.com \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=den@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).