summaryrefslogtreecommitdiffstats
path: root/block/vpc.c
diff options
context:
space:
mode:
authorAnthony Liguori2013-11-13 20:47:44 +0100
committerAnthony Liguori2013-11-13 20:47:44 +0100
commitdeb0f500651317863922964c87b4fa64eecdbd73 (patch)
treef67b4c5eabb590c5a51b64796cdb19e1dce07847 /block/vpc.c
parentMerge remote-tracking branch 'filippov/tags/20131108-xtensa' into staging (diff)
parentblock: Round up total_sectors (diff)
downloadqemu-deb0f500651317863922964c87b4fa64eecdbd73.tar.gz
qemu-deb0f500651317863922964c87b4fa64eecdbd73.tar.xz
qemu-deb0f500651317863922964c87b4fa64eecdbd73.zip
Merge remote-tracking branch 'stefanha/block' into staging
# By Jeff Cody (26) and others # Via Stefan Hajnoczi * stefanha/block: (37 commits) block: Round up total_sectors block: vhdx qemu-iotest - log replay of data sector block: qemu-iotests for vhdx, add write test support block: vhdx - update _make_test_img() to filter out vhdx options block: vhdx - add .bdrv_create() support block: vhdx - fix comment typos in header, fix incorrect struct fields block: vhdx - break out code operations to functions block: vhdx - move more endian translations to vhdx-endian.c block: vhdx - remove BAT file offset bit shifting block: vhdx write support block: vhdx - add log write support block: vhdx - add region overlap detection for image files block: vhdx - log parsing, replay, and flush support block: vhdx code movement - move vhdx_close() above vhdx_open() block: vhdx - update log guid in header, and first write tracker block: vhdx - break endian translation functions out block: vhdx - log support struct and defines block: vhdx code movement - VHDXMetadataEntries and BDRVVHDXState to header. block: vhdx - add header update capability. block: vhdx - minor comments and typo correction. ... Message-id: 1383905551-16411-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'block/vpc.c')
-rw-r--r--block/vpc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/vpc.c b/block/vpc.c
index 627d11cb9b..577cc45992 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -211,6 +211,15 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
bs->total_sectors = (int64_t)
be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl;
+ /* images created with disk2vhd report a far higher virtual size
+ * than expected with the cyls * heads * sectors_per_cyl formula.
+ * use the footer->size instead if the image was created with
+ * disk2vhd.
+ */
+ if (!strncmp(footer->creator_app, "d2v", 4)) {
+ bs->total_sectors = be64_to_cpu(footer->size) / BDRV_SECTOR_SIZE;
+ }
+
/* Allow a maximum disk size of approximately 2 TB */
if (bs->total_sectors >= 65535LL * 255 * 255) {
ret = -EFBIG;