qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, hch@lst.de, armbru@redhat.com, gleb@redhat.com,
	quintela@redhat.com
Subject: [Qemu-devel] [PATCH 3/3] qcow2: More checks for qemu-img check
Date: Mon, 15 Feb 2010 17:19:29 +0100	[thread overview]
Message-ID: <1266250769-5816-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1266250769-5816-1-git-send-email-kwolf@redhat.com>

Implement some more refcount block related checks

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2-refcount.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e7fdf64..e50fb2a 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1065,9 +1065,21 @@ int qcow2_check_refcounts(BlockDriverState *bs)
     for(i = 0; i < s->refcount_table_size; i++) {
         int64_t offset;
         offset = s->refcount_table[i];
+
+        /* Refcount blocks are cluster aligned */
+        if (offset & (s->cluster_size - 1)) {
+            fprintf(stderr, "ERROR refcount block %d is not "
+                "cluster aligned; refcount table entry corrupted\n", i);
+            errors++;
+        }
+
         if (offset != 0) {
             errors += inc_refcounts(bs, refcount_table, nb_clusters,
                           offset, s->cluster_size);
+            if (refcount_table[offset / s->cluster_size] != 1) {
+                fprintf(stderr, "ERROR refcount block %d refcount=%d\n",
+                    i, refcount_table[offset / s->cluster_size]);
+            }
         }
     }
 
-- 
1.6.6

  parent reply	other threads:[~2010-02-15 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 16:19 [Qemu-devel] [PATCH 0/3] qcow2: Rewrite alloc_refcount_block Kevin Wolf
2010-02-15 16:19 ` [Qemu-devel] [PATCH 1/3] qcow2: Factor next_refcount_table_size out Kevin Wolf
2010-02-18 10:40   ` [Qemu-devel] " Juan Quintela
2010-02-15 16:19 ` [Qemu-devel] [PATCH 2/3] qcow2: Rewrite alloc_refcount_block/grow_refcount_table Kevin Wolf
2010-02-18 12:02   ` [Qemu-devel] " Juan Quintela
2010-02-15 16:19 ` Kevin Wolf [this message]
2010-02-18 12:11   ` [Qemu-devel] Re: [PATCH 3/3] qcow2: More checks for qemu-img check Juan Quintela
2010-02-19 21:13 ` [Qemu-devel] [PATCH 0/3] qcow2: Rewrite alloc_refcount_block Anthony Liguori
2010-02-20  1:49   ` [Qemu-devel] " Juan Quintela
2010-02-20 17:02     ` Anthony Liguori
2010-02-22  8:54     ` Kevin Wolf
2010-02-22  9:55       ` Markus Armbruster

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=1266250769-5816-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=gleb@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).