On 30.07.19 16:18, Vladimir Sementsov-Ogievskiy wrote: > It improves performance for fragmented qcow2 images. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > block/qcow2.c | 125 +++++++++++++++++++++++++++++++++++++++++---- > block/trace-events | 1 + > 2 files changed, 115 insertions(+), 11 deletions(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 37766b8b7c..5f0e66ea48 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c
[...]
> @@ -2017,6 +2018,62 @@ fail:
> return ret;
> }
>
> +typedef struct Qcow2AioTask {
> + AioTask task;
> +
> + BlockDriverState *bs;
> + QCow2ClusterType cluster_type; /* only for read */
> + uint64_t file_cluster_offset;
> + uint64_t offset;
> + uint64_t bytes;
> + QEMUIOVector *qiov;
> + uint64_t qiov_offset;
> + QCowL2Meta *l2meta; /* only for write */
> +} Qcow2AioTask;
> +
> +#define QCOW2_MAX_WORKERS 8
Maybe move this to the top, or even qcow2.h?
[...]
> @@ -2112,7 +2182,16 @@ static coroutine_fn int
> qcow2_co_preadv_part(BlockDriverState *bs,
> qiov_offset += cur_bytes;
> }
>
> - return 0;
> +out:
> + if (aio) {
> + aio_task_pool_wait_all(aio);
> + if (ret == 0) {
> + ret = aio_task_pool_status(aio);
> + }
> + g_free(aio);
> + }
> +
> + return ret;
My gcc complains here that ret may be initialized. (Which is indeed the
case if @bytes is 0.)
The rest looks good to me.
Max
signature.asc
Description: OpenPGP digital signature
