@@ -681,7 +681,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options)
uint8_t buf[1024];
struct vhd_footer *footer = (struct vhd_footer *) buf;
QEMUOptionParameter *disk_type_param;
- int fd, i;
+ int fd;
uint16_t cyls = 0;
uint8_t heads = 0;
uint8_t secs_per_cyl = 0;
@@ -718,16 +718,11 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options)
* qemu-img convert doesn't truncate images, but rather rounds up.
*/
total_sectors = total_size / BDRV_SECTOR_SIZE;
- for (i = 0; total_sectors > (int64_t)cyls * heads * secs_per_cyl; i++) {
- if (calculate_geometry(total_sectors + i, &cyls, &heads,
- &secs_per_cyl)) {
- ret = -EFBIG;
- goto fail;
- }
+ if (calculate_geometry(total_sectors, &cyls, &heads, &secs_per_cyl)) {
+ ret = -EFBIG;
+ goto fail;
}
- total_sectors = (int64_t) cyls * heads * secs_per_cyl;
-
/* Prepare the Hard Disk Footer */
memset(buf, 0, 1024);
QEMU now gets the correct size for VHD images, so this workaround is no longer needed. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- block/vpc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)