All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Pavel Butsykin <pbutsykin@virtuozzo.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, eblake@redhat.com, armbru@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH v3 3/4] qcow2: add shrink image support
Date: Mon, 10 Jul 2017 00:08:10 +0200	[thread overview]
Message-ID: <144bc29f-5d9f-6cf5-ec65-193ad64c9fc9@redhat.com> (raw)
In-Reply-To: <20170707143028.692-4-pbutsykin@virtuozzo.com>

[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]

On 2017-07-07 16:30, Pavel Butsykin wrote:
> This patch add shrinking of the image file for qcow2. As a result, this allows
> us to reduce the virtual image size and free up space on the disk without
> copying the image. Image can be fragmented and shrink is done by punching holes
> in the image file.
> 
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
>  block/qcow2-cluster.c  |  40 +++++++++++++++++++
>  block/qcow2-refcount.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++
>  block/qcow2.c          |  42 +++++++++++++++-----
>  block/qcow2.h          |  14 +++++++
>  qapi/block-core.json   |   3 +-
>  5 files changed, 191 insertions(+), 11 deletions(-)

[...]

> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 0141c9cbe7..443fca6a98 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c

[...]

> @@ -2945,3 +2946,105 @@ done:

[...]

> +            ret = qcow2_cache_get(bs, s->refcount_block_cache, refblock_offs,
> +                                  &refblock);
> +            if (ret < 0) {
> +                goto out;
> +            }
> +
> +            if (s->get_refcount(refblock, block_index) != 1) {
> +                qcow2_cache_put(bs, s->refcount_block_cache, &refblock);
> +                ret = -EINVAL;

Optional: You could mark the image corrupt here.

Anyway:

Reviewed-by: Max Reitz <mreitz@redhat.com>

> +                goto out;
> +            }
> +            s->set_refcount(refblock, block_index, 0);


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 498 bytes --]

  parent reply	other threads:[~2017-07-09 22:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07 14:30 [Qemu-devel] [PATCH v3 0/4] Add shrink image for qcow2 Pavel Butsykin
2017-07-07 14:30 ` [Qemu-devel] [PATCH v3 1/4] qemu-img: add --shrink flag for resize Pavel Butsykin
2017-07-07 21:12   ` Eric Blake
2017-07-09 21:22     ` Max Reitz
2017-07-07 14:30 ` [Qemu-devel] [PATCH v3 2/4] qcow2: add qcow2_cache_discard Pavel Butsykin
2017-07-09 21:34   ` Max Reitz
2017-07-07 14:30 ` [Qemu-devel] [PATCH v3 3/4] qcow2: add shrink image support Pavel Butsykin
2017-07-07 21:26   ` Eric Blake
2017-07-09 22:08     ` Max Reitz
2017-07-09 22:08   ` Max Reitz [this message]
2017-07-07 14:30 ` [Qemu-devel] [PATCH v3 4/4] qemu-iotests: add shrinking image test Pavel Butsykin

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=144bc29f-5d9f-6cf5-ec65-193ad64c9fc9@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbutsykin@virtuozzo.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 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.