All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	Alberto Garcia <berto@igalia.com>,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <26945f48-b5dc-49f6-4184-b10379cf510c@redhat.com> (raw)
In-Reply-To: <20171110203759.14018-2-mreitz@redhat.com>

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

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 <mreitz@redhat.com>
> ---
>  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 <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

  reply	other threads:[~2017-11-10 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 20:37 [Qemu-devel] [PATCH for-2.12 0/1] qcow2: Repair unaligned preallocated zero clusters Max Reitz
2017-11-10 20:37 ` [Qemu-devel] [PATCH for-2.12 1/1] " Max Reitz
2017-11-10 20:51   ` Eric Blake [this message]
2018-01-17 13:19 ` [Qemu-devel] [PATCH for-2.12 0/1] " 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=26945f48-b5dc-49f6-4184-b10379cf510c@redhat.com \
    --to=eblake@redhat.com \
    --cc=berto@igalia.com \
    --cc=jsnow@redhat.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 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.