All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH 0/4] qcow2: Improve refcount structure rebuilding
Date: Wed, 10 Mar 2021 16:59:02 +0100	[thread overview]
Message-ID: <20210310155906.147478-1-mreitz@redhat.com> (raw)

Hi,

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).

So patch 1 modifies the algorithm to put the reftable into the first
free space in the image, and patch 4 adds a test.  So that we can make
patch 4 a bit nicer, patches 2 and 3 are included.  (In case you don’t
like anything about 2 or 3, I also have a version of this series without
patches 2 and 3, where 4 is correspondingly unnicer.)


Max Reitz (4):
  qcow2: Improve refcount structure rebuilding
  iotests/common.qemu: Add _cleanup_single_qemu
  iotests/common.qemu: Allow using the QSD
  iotests/108: Test new refcount rebuild algorithm

 block/qcow2-refcount.c         | 126 ++++++++--------
 tests/qemu-iotests/108         | 259 +++++++++++++++++++++++++++++++++
 tests/qemu-iotests/108.out     |  80 ++++++++++
 tests/qemu-iotests/common.qemu | 108 ++++++++++----
 4 files changed, 483 insertions(+), 90 deletions(-)

-- 
2.29.2



             reply	other threads:[~2021-03-10 16:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 15:59 Max Reitz [this message]
2021-03-10 15:59 ` [PATCH 1/4] qcow2: Improve refcount structure rebuilding Max Reitz
2021-03-26 11:48   ` Vladimir Sementsov-Ogievskiy
2021-03-26 13:47     ` Max Reitz
2021-03-26 14:38       ` Vladimir Sementsov-Ogievskiy
2021-03-10 15:59 ` [PATCH 2/4] iotests/common.qemu: Add _cleanup_single_qemu Max Reitz
2021-03-10 15:59 ` [PATCH 3/4] iotests/common.qemu: Allow using the QSD Max Reitz
2021-03-10 15:59 ` [PATCH 4/4] iotests/108: Test new refcount rebuild algorithm Max Reitz
2021-03-10 16:07   ` Eric Blake

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=20210310155906.147478-1-mreitz@redhat.com \
    --to=mreitz@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 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.