mirror of https://github.com/xemu-project/xemu.git
qcow1: Fix compressed images (Kevin Wolf)
Revert r4673, the removed dead code wasn't dead in fact. Additionally, change the misleading else which tricks the reader into believing that allocate is a boolean to else if (allocate == 2). Signed-off-by: Kevin Wolf <kwolf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6244 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
062e55272e
commit
7f48fa1f05
|
@ -339,6 +339,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
|
|||
return -1;
|
||||
} else {
|
||||
cluster_offset = bdrv_getlength(s->hd);
|
||||
if (allocate == 1) {
|
||||
/* round to cluster size */
|
||||
cluster_offset = (cluster_offset + s->cluster_size - 1) &
|
||||
~(s->cluster_size - 1);
|
||||
|
@ -362,6 +363,10 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (allocate == 2) {
|
||||
cluster_offset |= QCOW_OFLAG_COMPRESSED |
|
||||
(uint64_t)compressed_size << (63 - s->cluster_bits);
|
||||
}
|
||||
}
|
||||
/* update L2 table */
|
||||
tmp = cpu_to_be64(cluster_offset);
|
||||
|
|
Loading…
Reference in New Issue