From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH] qcow2: Fix preallocation on images with unaligned sizes
Date: Wed, 10 Jun 2020 15:02:17 -0500 [thread overview]
Message-ID: <abffdc15-605b-6561-2df8-c6b38a8275c5@redhat.com> (raw)
In-Reply-To: <20200610094600.4029-1-berto@igalia.com>
On 6/10/20 4:46 AM, Alberto Garcia wrote:
> When resizing an image with qcow2_co_truncate() using the falloc or
> full preallocation modes the code assumes that both the old and new
> sizes are cluster-aligned.
>
> There are two problems with this:
>
> 1) The calculation of how many clusters are involved does not always
> get the right result.
>
> Example: creating a 60KB image and resizing it (with
> preallocation=full) to 80KB won't allocate the second cluster.
>
> 2) No copy-on-write is performed, so in the previous example if
> there is a backing file then the first 60KB of the first cluster
> won't be filled with data from the backing file.
>
> This patch fixes both issues.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> block/qcow2.c | 17 ++++++++++++++---
> tests/qemu-iotests/125 | 21 +++++++++++++++++++++
> tests/qemu-iotests/125.out | 9 +++++++++
> 3 files changed, 44 insertions(+), 3 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-06-10 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 9:46 [PATCH] qcow2: Fix preallocation on images with unaligned sizes Alberto Garcia
2020-06-10 20:02 ` Eric Blake [this message]
2020-06-16 15:07 ` Max Reitz
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=abffdc15-605b-6561-2df8-c6b38a8275c5@redhat.com \
--to=eblake@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).