From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
qemu-devel@nongnu.org
Subject: [PATCH v2 0/2] qcow2: Improve refcount structure rebuilding
Date: Tue, 29 Mar 2022 11:19:15 +0200 [thread overview]
Message-ID: <20220329091917.24512-1-hreitz@redhat.com> (raw)
Hi,
v1 cover letter:
https://lists.nongnu.org/archive/html/qemu-block/2021-03/msg00651.html
Since it’s been a while since v1, let me reproduce parts from that cover
letter here:
When the qcow2 refcount structure is broken to a point where we cannot
rely on any information from it (because it shows clusters as free that
are in use), “qemu-img check -r all” completely rewrites it.
The new reftable is preferably written into the area covered by the last
refblock for the image, but if that refblock is empty (e.g. because the
image is on a block device and there is just nothing near the end of the
block device), then the reftable will be put after the image’s end.
Which is a problem on block devices, because they can’t easily be
resized (also, resizing wouldn’t really help in this case, because the
reftable would still be written past the new end).
Effectively, this means you can’t run `qemu-img check -r all` on qcow2
images that are on block devices when there are clusters that are in
use, but not marked as allocated.
I recommend reviewing patch 1 not based on the diff, but by applying it
and reviewing the rebuild_refcount_structure() function (and its new
rebuild_refcounts_write_refblocks() helper).
v2:
- Dropped patches 2 and 3 (not really necessary with QSD --daemonize),
which used to bring support for the QSD to _launch_qemu
- Patch 1: Functionally the same (I hope), but I have added extensive
comments and put the `for ()` loop into its own dedicated function so
that we can get rid of the backwards-jumping goto
- Patch 2: Changed to make do without _launch_qemu having QSD support
git backport-diff against v1:
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/2:[0370] [FC] 'qcow2: Improve refcount structure rebuilding'
002/2:[0047] [FC] 'iotests/108: Test new refcount rebuild algorithm'
Hanna Reitz (2):
qcow2: Improve refcount structure rebuilding
iotests/108: Test new refcount rebuild algorithm
block/qcow2-refcount.c | 332 ++++++++++++++++++++++++++-----------
tests/qemu-iotests/108 | 259 ++++++++++++++++++++++++++++-
tests/qemu-iotests/108.out | 81 +++++++++
3 files changed, 574 insertions(+), 98 deletions(-)
--
2.35.1
next reply other threads:[~2022-03-29 9:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 9:19 Hanna Reitz [this message]
2022-03-29 9:19 ` [PATCH v2 1/2] qcow2: Improve refcount structure rebuilding Hanna Reitz
2022-03-30 14:32 ` Eric Blake
2022-04-01 13:49 ` Hanna Reitz
2022-03-29 9:19 ` [PATCH v2 2/2] iotests/108: Test new refcount rebuild algorithm Hanna Reitz
2022-03-30 15:07 ` Eric Blake
2022-04-01 13:55 ` Hanna 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=20220329091917.24512-1-hreitz@redhat.com \
--to=hreitz@redhat.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).