[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 34/35] qcow2: align cluster_data to block to improve
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 34/35] qcow2: align cluster_data to block to improve performance using O_DIRECT |
Date: |
Mon, 12 Sep 2011 16:19:33 +0200 |
From: Frediano Ziglio <address@hidden>
Signed-off-by: Frediano Ziglio <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 8aed310..510ff68 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -237,7 +237,7 @@ static int qcow2_open(BlockDriverState *bs, int flags)
s->cluster_cache = g_malloc(s->cluster_size);
/* one more sector for decompressed data alignment */
- s->cluster_data = g_malloc(QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size
+ s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS *
s->cluster_size
+ 512);
s->cluster_cache_offset = -1;
@@ -296,7 +296,7 @@ static int qcow2_open(BlockDriverState *bs, int flags)
qcow2_cache_destroy(bs, s->l2_table_cache);
}
g_free(s->cluster_cache);
- g_free(s->cluster_data);
+ qemu_vfree(s->cluster_data);
return ret;
}
@@ -456,7 +456,7 @@ static int qcow2_co_readv(BlockDriverState *bs, int64_t
sector_num,
*/
if (!cluster_data) {
cluster_data =
- g_malloc0(QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size);
+ qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS *
s->cluster_size);
}
assert(cur_nr_sectors <=
@@ -496,7 +496,7 @@ fail:
qemu_co_mutex_unlock(&s->lock);
qemu_iovec_destroy(&hd_qiov);
- g_free(cluster_data);
+ qemu_vfree(cluster_data);
return ret;
}
@@ -566,7 +566,7 @@ static int qcow2_co_writev(BlockDriverState *bs,
if (s->crypt_method) {
if (!cluster_data) {
- cluster_data = g_malloc0(QCOW_MAX_CRYPT_CLUSTERS *
+ cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS *
s->cluster_size);
}
@@ -611,7 +611,7 @@ fail:
qemu_co_mutex_unlock(&s->lock);
qemu_iovec_destroy(&hd_qiov);
- g_free(cluster_data);
+ qemu_vfree(cluster_data);
return ret;
}
@@ -628,7 +628,7 @@ static void qcow2_close(BlockDriverState *bs)
qcow2_cache_destroy(bs, s->refcount_block_cache);
g_free(s->cluster_cache);
- g_free(s->cluster_data);
+ qemu_vfree(s->cluster_data);
qcow2_refcount_close(bs);
}
--
1.7.6
- [Qemu-devel] [PATCH 16/35] rbd: allow client id to be specified in config string, (continued)
- [Qemu-devel] [PATCH 16/35] rbd: allow client id to be specified in config string, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 21/35] ide/atapi: Preserve tray state on migration, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 12/35] scsi-disk: Track tray locked state, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 15/35] block: Rename bdrv_set_locked() to bdrv_lock_medium(), Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 22/35] block: Clean up remaining users of "removable", Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 20/35] scsi-disk: Fix START_STOP to fail when it can't eject, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 28/35] block: Reset buffer alignment on detach, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 24/35] block: Show whether the virtual tray is open in info block, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 31/35] ide/atapi scsi-disk: Make monitor eject -f, then change work, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 35/35] qcow2: fix range check, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 34/35] qcow2: align cluster_data to block to improve performance using O_DIRECT,
Kevin Wolf <=
- [Qemu-devel] [PATCH 19/35] ide/atapi: Don't fail eject when tray is already open, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 25/35] block: Move BlockConf & friends from block_int.h to block.h, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 26/35] hw: Trim superfluous #include "block_int.h", Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 30/35] block: New change_media_cb() parameter load, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 32/35] qcow2: initialize metadata before inserting in cluster_allocs, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 23/35] block: Drop BlockDriverState member removable, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 33/35] ahci: Remove unused struct member, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 17/35] rbd: clean up, fix style, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 18/35] rbd: fix leak in qemu_rbd_open failure paths, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 29/35] nbd: Clean up use of block_int.h, Kevin Wolf, 2011/09/12