[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/30] qemu-img: Use qemu_blockalign
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 05/30] qemu-img: Use qemu_blockalign |
Date: |
Mon, 29 Aug 2011 16:53:13 +0200 |
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 <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
qemu-img.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 10a3a8b..2fee782 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);
}
/*
--
1.7.6
- [Qemu-devel] [PULL 00/30] Block patches, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 02/30] block: parse cache mode flags in a single place, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 01/30] coroutine: Add CoRwlock support, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 06/30] qcow2: fix typo in documentation for qcow2_get_cluster_offset(), Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 03/30] block: add cache=directsync parameter to -drive, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 07/30] qcow: initialize coroutine mutex, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 04/30] qcow2: Fix DEBUG_* compilation, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 05/30] qemu-img: Use qemu_blockalign,
Kevin Wolf <=
- [Qemu-devel] [PATCH 09/30] block/curl: Handle failed reads gracefully., Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 11/30] posix-aio-compat: fix latency issues, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 10/30] block: include flush requests in info blockstats, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 12/30] qcow/qcow2: Allocate QCowAIOCB structure using stack, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 19/30] qcow2: remove l2meta from QCowAIOCB, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 13/30] qcow: QCowAIOCB field cleanup, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 08/30] qemu-img: print error codes when convert fails, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 15/30] qcow: Remove QCowAIOCB, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 14/30] qcow: move some blocks of code to avoid useless variable initialization, Kevin Wolf, 2011/08/29
- [Qemu-devel] [PATCH 20/30] qcow2: remove cluster_offset from QCowAIOCB, Kevin Wolf, 2011/08/29