From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6212] Fix compressed qcow2 (Gleb Natapov)
Date: Wed, 07 Jan 2009 16:43:13 +0000 [thread overview]
Message-ID: <E1LKbUv-0002Ol-9r@cvs.savannah.gnu.org> (raw)
Revision: 6212
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6212
Author: aliguori
Date: 2009-01-07 16:43:13 +0000 (Wed, 07 Jan 2009)
Log Message:
-----------
Fix compressed qcow2 (Gleb Natapov)
Correctly calculate number of contiguous clusters.
Acked-by: Kevin Wolf <kwolf@suse.de>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/block-qcow2.c
Modified: trunk/block-qcow2.c
===================================================================
--- trunk/block-qcow2.c 2009-01-07 16:41:47 UTC (rev 6211)
+++ trunk/block-qcow2.c 2009-01-07 16:43:13 UTC (rev 6212)
@@ -620,6 +620,9 @@
int i;
uint64_t offset = be64_to_cpu(l2_table[0]) & ~mask;
+ if (!offset)
+ return 0;
+
for (i = 0; i < nb_clusters; i++)
if (offset + i * cluster_size != (be64_to_cpu(l2_table[i]) & ~mask))
break;
@@ -981,6 +984,12 @@
/* how many available clusters ? */
while (i < nb_clusters) {
+ i += count_contiguous_clusters(nb_clusters - i, s->cluster_size,
+ &l2_table[l2_index + i], 0);
+
+ if(be64_to_cpu(l2_table[l2_index + i]))
+ break;
+
i += count_contiguous_free_clusters(nb_clusters - i,
&l2_table[l2_index + i]);
@@ -989,12 +998,6 @@
if ((cluster_offset & QCOW_OFLAG_COPIED) ||
(cluster_offset & QCOW_OFLAG_COMPRESSED))
break;
-
- i += count_contiguous_clusters(nb_clusters - i, s->cluster_size,
- &l2_table[l2_index + i], 0);
-
- if(be64_to_cpu(l2_table[l2_index + i]))
- break;
}
nb_clusters = i;
reply other threads:[~2009-01-07 16:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1LKbUv-0002Ol-9r@cvs.savannah.gnu.org \
--to=anthony@codemonkey.ws \
--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).