]> Git Repo - qemu.git/commitdiff
qcow2: Fix "total clusters" number in bdrv_check
authorKevin Wolf <[email protected]>
Tue, 26 Mar 2013 16:49:54 +0000 (17:49 +0100)
committerStefan Hajnoczi <[email protected]>
Thu, 28 Mar 2013 10:52:42 +0000 (11:52 +0100)
This should be based on the virtual disk size, not on the size of the
image.

Interesting observation: With some VM state stored in the image file,
percentages higher than 100% are possible, even though snapshots
themselves are ignored. This is a qcow2 bug to be fixed another day: The
VM state should be discarded in the active L2 tables after completing
the snapshot creation.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
block/qcow2-refcount.c
tests/qemu-iotests/044.out

index 9bfb390519865b06a077b86474e0c255ae64f8cf..c38e970bf2adc58c9158daa3d51e0957dcbb9233 100644 (file)
@@ -1152,9 +1152,11 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
 
     size = bdrv_getlength(bs->file);
     nb_clusters = size_to_clusters(s, size);
-    res->bfi.total_clusters = nb_clusters;
     refcount_table = g_malloc0(nb_clusters * sizeof(uint16_t));
 
+    res->bfi.total_clusters =
+        size_to_clusters(s, bs->total_sectors * BDRV_SECTOR_SIZE);
+
     /* header */
     inc_refcounts(bs, res, refcount_table, nb_clusters,
         0, s->cluster_size);
index 5eed3f87a324352bce82eb8d4f843c929409fe1c..34c25c793e49ac3dc6c7be707d00cd405e8dd593 100644 (file)
@@ -1,5 +1,5 @@
 No errors were found on the image.
-7292415/8391499= 86.90% allocated, 0.00% fragmented, 0.00% compressed clusters
+7292415/33554432 = 21.73% allocated, 0.00% fragmented, 0.00% compressed clusters
 Image end offset: 4296447488
 .
 ----------------------------------------------------------------------
This page took 0.029025 seconds and 4 git commands to generate.