From 40b4f539678266160badd5ac4afa9833f9089154 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 9 Sep 2009 17:53:37 +0200 Subject: Add bdrv_aio_multiwrite One performance problem of qcow2 during the initial image growth are sequential writes that are not cluster aligned. In this case, when a first requests requires to allocate a new cluster but writes only to the first couple of sectors in that cluster, the rest of the cluster is zeroed - just to be overwritten by the following second request that fills up the cluster. Let's try to merge sequential write requests to the same cluster, so we can avoid to write the zero padding to the disk in the first place. As a nice side effect, also other formats take advantage of dealing with less and larger requests. Signed-off-by: Kevin Wolf Signed-off-by: Anthony Liguori --- block.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'block.h') diff --git a/block.h b/block.h index 28bf357091..ea6905291e 100644 --- a/block.h +++ b/block.h @@ -87,6 +87,21 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, BlockDriverCompletionFunc *cb, void *opaque); void bdrv_aio_cancel(BlockDriverAIOCB *acb); +typedef struct BlockRequest { + /* Fields to be filled by multiwrite caller */ + int64_t sector; + int nb_sectors; + QEMUIOVector *qiov; + BlockDriverCompletionFunc *cb; + void *opaque; + + /* Filled by multiwrite implementation */ + int error; +} BlockRequest; + +int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, + int num_reqs); + /* sg packet commands */ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, -- cgit v1.2.3