[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.12 1/1] qcow2: Repair unaligned preallocat
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH for-2.12 1/1] qcow2: Repair unaligned preallocated zero clusters |
Date: |
Fri, 10 Nov 2017 14:51:43 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/10/2017 02:37 PM, Max Reitz wrote:
> We can easily repair unaligned preallocated zero clusters by discarding
> them, so why not do it?
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/qcow2-refcount.c | 70
> ++++++++++++++++++++++++++++++++++++++--------
> tests/qemu-iotests/060 | 3 +-
> tests/qemu-iotests/060.out | 9 ++++++
> 3 files changed, 69 insertions(+), 13 deletions(-)
>
>
> + /* Correct offsets are cluster aligned */
> + if (offset_into_cluster(s, offset)) {
> + if (qcow2_get_cluster_type(l2_entry) ==
> + QCOW2_CLUSTER_ZERO_ALLOC)
> + {
> + fprintf(stderr, "%s offset=%" PRIx64 ": Preallocated
> zero "
> + "cluster is not properly aligned; L2 entry "
> + "corrupted.\n",
> + fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR",
> + offset);
Is fprintf() still the right thing to be using?
> @@ -1586,13 +1637,6 @@ static int check_refcounts_l2(BlockDriverState *bs,
> BdrvCheckResult *res,
> if (ret < 0) {
> goto fail;
> }
> -
> - /* Correct offsets are cluster aligned */
> - if (offset_into_cluster(s, offset)) {
> - fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not "
> - "properly aligned; L2 entry corrupted.\n", offset);
But it's no worse than what you are refactoring.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature