[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 14/17] vpc: Ignore geometry for large images
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 14/17] vpc: Ignore geometry for large images |
Date: |
Mon, 16 Mar 2015 17:57:18 +0100 |
The CHS calculation as done per the VHD spec imposes a maximum image
size of ~127 GB. Real VHD images exist that are larger than that.
Apparently there are two separate non-standard ways to achieve this:
You could use more heads than the spec does - this is the option that
qemu-img create chooses.
However, other images exist where the geometry is set to the maximum
(65535/16/255), but the actual image size is larger. Until now, such
images are truncated at 127 GB when opening them with qemu.
This patch changes the vpc driver to ignore geometry in this case and
only trust the size field in the header.
Signed-off-by: Kevin Wolf <address@hidden>
[PL: Fixed maximum geometry in the commit msg]
Signed-off-by: Peter Lieven <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/vpc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/block/vpc.c b/block/vpc.c
index c8e17cb..1c9592c 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -215,12 +215,10 @@ 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)) {
+ /* Images that have exactly the maximum geometry are probably bigger and
+ * would be truncated if we adhered to the geometry for them. Rely on
+ * footer->size for them. */
+ if (bs->total_sectors == 65535ULL * 16 * 255) {
bs->total_sectors = be64_to_cpu(footer->size) / BDRV_SECTOR_SIZE;
}
--
1.8.3.1
- [Qemu-block] [PULL 06/17] qcow2: Respect new_block in alloc_refcount_block(), (continued)
- [Qemu-block] [PULL 06/17] qcow2: Respect new_block in alloc_refcount_block(), Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 05/17] qemu-img: Avoid qerror_report_err() outside QMP handlers, again, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 09/17] monitor: Convert bdrv_find to blk_by_name, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 10/17] migration: Convert bdrv_find to blk_by_name, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 07/17] iotests: Add tests for refcount table growth, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 08/17] iotests: Test non-self-referential qcow2 refblocks, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 11/17] blockdev: Convert bdrv_find to blk_by_name, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 13/17] block/vpc: optimize vpc_co_get_block_status, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 16/17] block/vpc: rename footer->size -> footer->current_size, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 12/17] block: Drop bdrv_find, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 14/17] vpc: Ignore geometry for large images,
Kevin Wolf <=
- [Qemu-block] [PULL 17/17] block/vpc: remove disabled code from get_sector_offset, Kevin Wolf, 2015/03/16
- [Qemu-block] [PULL 15/17] block/vpc: make calculate_geometry spec conform, Kevin Wolf, 2015/03/16
- Re: [Qemu-block] [Qemu-devel] [PULL 00/17] Block patches for 2.3.0-rc0, Peter Maydell, 2015/03/17