diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-08 09:38:41 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-08 09:38:41 -0500 |
commit | 7c652c1eaf20b9271ebcc92b788d1fe656b3a774 (patch) | |
tree | b82120a0cecc99af4261329bd01e8e914e01a9db /block/qcow2-cluster.c | |
parent | e45bca682ca1b63cdfba9c8a6b164d1838a2eda4 (diff) | |
parent | 21fcf36095939a97fc3df578e12821c3e6c3ba78 (diff) |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony:
fdc: simplify media change handling
qcow2: lock on prealloc
block: make bdrv_create adopt coroutine
qcow2: Limit COW to where it's needed
sheepdog: switch to writethrough mode if cluster doesn't support flush
Diffstat (limited to 'block/qcow2-cluster.c')
-rw-r--r-- | block/qcow2-cluster.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 353889d41b..10c22fe12b 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -883,15 +883,19 @@ again: assert(keep_clusters <= nb_clusters); nb_clusters -= keep_clusters; } else { + keep_clusters = 0; + cluster_offset = 0; + } + + if (nb_clusters > 0) { /* For the moment, overwrite compressed clusters one by one */ - if (cluster_offset & QCOW_OFLAG_COMPRESSED) { + uint64_t entry = be64_to_cpu(l2_table[l2_index + keep_clusters]); + if (entry & QCOW_OFLAG_COMPRESSED) { nb_clusters = 1; } else { - nb_clusters = count_cow_clusters(s, nb_clusters, l2_table, l2_index); + nb_clusters = count_cow_clusters(s, nb_clusters, l2_table, + l2_index + keep_clusters); } - - keep_clusters = 0; - cluster_offset = 0; } cluster_offset &= L2E_OFFSET_MASK; |