aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-08-08 14:09:12 +0200
committerKevin Wolf <kwolf@redhat.com>2011-08-23 14:15:17 +0200
commitbb1c05973cf2206b628b0dc064f7e022b63f2702 (patch)
treef5179cc0d80da614133ffc521a35d26c5be8a55e /qemu-img.c
parent6cbc3031c8408e4cb3e55a01f25536e81d3ae90d (diff)
qemu-img: Use qemu_blockalign
Now that you can use cache=none for the output file in qemu-img, we should properly align our buffers so that raw-posix doesn't have to use its (smaller) bounce buffer. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 10a3a8bb52..2fee782217 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -814,7 +814,7 @@ static int img_convert(int argc, char **argv)
bs_i = 0;
bs_offset = 0;
bdrv_get_geometry(bs[0], &bs_sectors);
- buf = g_malloc(IO_BUF_SIZE);
+ buf = qemu_blockalign(out_bs, IO_BUF_SIZE);
if (compress) {
ret = bdrv_get_info(out_bs, &bdi);
@@ -986,7 +986,7 @@ out:
qemu_progress_end();
free_option_parameters(create_options);
free_option_parameters(param);
- g_free(buf);
+ qemu_vfree(buf);
if (out_bs) {
bdrv_delete(out_bs);
}
@@ -1353,8 +1353,8 @@ static int img_rebase(int argc, char **argv)
uint8_t * buf_new;
float local_progress;
- buf_old = g_malloc(IO_BUF_SIZE);
- buf_new = g_malloc(IO_BUF_SIZE);
+ buf_old = qemu_blockalign(bs, IO_BUF_SIZE);
+ buf_new = qemu_blockalign(bs, IO_BUF_SIZE);
bdrv_get_geometry(bs, &num_sectors);
@@ -1410,8 +1410,8 @@ static int img_rebase(int argc, char **argv)
qemu_progress_print(local_progress, 100);
}
- g_free(buf_old);
- g_free(buf_new);
+ qemu_vfree(buf_old);
+ qemu_vfree(buf_new);
}
/*