diff mbox

[6/7] block/vpc: Remove workaround for geometry calculation

Message ID 1359755494-28012-7-git-send-email-sw@weilnetz.de
State Under Review
Headers show

Commit Message

Stefan Weil Feb. 1, 2013, 9:51 p.m. UTC
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(-)

Comments

Kevin Wolf Feb. 5, 2013, 11:37 a.m. UTC | #1
Am 01.02.2013 22:51, schrieb Stefan Weil:
> QEMU now gets the correct size for VHD images, so this workaround is no
> longer needed.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

This isn't about qemu, but about VPC. Whether we need this code is
probably closely related to whether patch 5 is correct.

Kevin
diff mbox

Patch

diff --git a/block/vpc.c b/block/vpc.c
index 799b1c9..e8968c2 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -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);