qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: mreitz@redhat.com, kwolf@redhat.com, den@virtuozzo.com,
	vsementsov@virtuozzo.com
Subject: [Qemu-devel] [PATCH v5 4/5] qcow2-refcount: check_refcounts_l2: don't count fixed cluster as allocated
Date: Wed, 27 Feb 2019 16:14:32 +0300	[thread overview]
Message-ID: <20190227131433.197063-5-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20190227131433.197063-1-vsementsov@virtuozzo.com>

Do not count a cluster which is fixed to be ZERO as allocated.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
 block/qcow2-refcount.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 00a922edfa..35a9d943f2 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1641,15 +1641,6 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
         {
             uint64_t offset = l2_entry & L2E_OFFSET_MASK;
 
-            if (flags & CHECK_FRAG_INFO) {
-                res->bfi.allocated_clusters++;
-                if (next_contiguous_offset &&
-                    offset != next_contiguous_offset) {
-                    res->bfi.fragmented_clusters++;
-                }
-                next_contiguous_offset = offset + s->cluster_size;
-            }
-
             /* Correct offsets are cluster aligned */
             if (offset_into_cluster(s, offset)) {
                 if (qcow2_get_cluster_type(l2_entry) ==
@@ -1702,6 +1693,15 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
                 }
             }
 
+            if (flags & CHECK_FRAG_INFO) {
+                res->bfi.allocated_clusters++;
+                if (next_contiguous_offset &&
+                    offset != next_contiguous_offset) {
+                    res->bfi.fragmented_clusters++;
+                }
+                next_contiguous_offset = offset + s->cluster_size;
+            }
+
             /* Mark cluster as used */
             ret = qcow2_inc_refcounts_imrt(bs, res,
                                            refcount_table, refcount_table_size,
-- 
2.18.0

  parent reply	other threads:[~2019-02-27 13:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 13:14 [Qemu-devel] [PATCH v5 0/5] qcow2 check improvements part I Vladimir Sementsov-Ogievskiy
2019-02-27 13:14 ` [Qemu-devel] [PATCH v5 1/5] qcow2-refcount: fix check_oflag_copied Vladimir Sementsov-Ogievskiy
2019-02-27 13:14 ` [Qemu-devel] [PATCH v5 2/5] qcow2-refcount: avoid eating RAM Vladimir Sementsov-Ogievskiy
2019-02-27 13:14 ` [Qemu-devel] [PATCH v5 3/5] qcow2-refcount: check_refcounts_l2: reduce ignored overlaps Vladimir Sementsov-Ogievskiy
2019-02-27 13:14 ` Vladimir Sementsov-Ogievskiy [this message]
2019-02-27 13:14 ` [Qemu-devel] [PATCH v5 5/5] qcow2-refcount: don't mask corruptions under internal errors Vladimir Sementsov-Ogievskiy
2019-02-27 13:18   ` Max Reitz
2019-04-01 20:00 ` [Qemu-devel] [PATCH v5 0/5] qcow2 check improvements part I 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=20190227131433.197063-5-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@virtuozzo.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 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).