diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-11-14 11:12:40 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-11-14 11:12:40 +0000 |
commit | b87dcdd0746dc110fa5a3353cbc257818e618930 (patch) | |
tree | 10b23bff5968ca2c11178b8559e02bcfd7147ad6 /block/vmdk.c | |
parent | c52e67924fbdadfa00668248f5c075542943c54c (diff) | |
parent | 5f58330790b72c4705b373ee0646fb3adf800b4e (diff) | |
download | qemu-b87dcdd0746dc110fa5a3353cbc257818e618930.zip qemu-b87dcdd0746dc110fa5a3353cbc257818e618930.tar.gz qemu-b87dcdd0746dc110fa5a3353cbc257818e618930.tar.bz2 |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Fri 14 Nov 2014 11:05:54 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/block-pull-request:
vmdk: Leave bdi intact if -ENOTSUP in vmdk_get_info
block: Fix max nb_sectors in bdrv_make_zero
ahci: factor out FIS decomposition from handle_cmd
ahci: Check cmd_fis[1] more explicitly
ahci: Reorder error cases in handle_cmd
ahci: Fix FIS decomposition
ahci: add is_ncq predicate helper
ide: Correct handling of malformed/short PRDTs
ahci: unify sglist preparation
ide: repair PIO transfers for cases where nsector > 1
ahci: Fix byte count regression for ATAPI/PIO
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r-- | block/vmdk.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index 673d3f5..2cbfd3e 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2137,23 +2137,29 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) return spec_info; } +static bool vmdk_extents_type_eq(const VmdkExtent *a, const VmdkExtent *b) +{ + return a->flat == b->flat && + a->compressed == b->compressed && + (a->flat || a->cluster_sectors == b->cluster_sectors); +} + static int vmdk_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { int i; BDRVVmdkState *s = bs->opaque; assert(s->num_extents); - bdi->needs_compressed_writes = s->extents[0].compressed; - if (!s->extents[0].flat) { - bdi->cluster_size = s->extents[0].cluster_sectors << BDRV_SECTOR_BITS; - } + /* See if we have multiple extents but they have different cases */ for (i = 1; i < s->num_extents; i++) { - if (bdi->needs_compressed_writes != s->extents[i].compressed || - (bdi->cluster_size && bdi->cluster_size != - s->extents[i].cluster_sectors << BDRV_SECTOR_BITS)) { + if (!vmdk_extents_type_eq(&s->extents[0], &s->extents[i])) { return -ENOTSUP; } } + bdi->needs_compressed_writes = s->extents[0].compressed; + if (!s->extents[0].flat) { + bdi->cluster_size = s->extents[0].cluster_sectors << BDRV_SECTOR_BITS; + } return 0; } |