qcow2: Order concurrent AIO requests on the same unallocated cluster
commitf214978a427ea40b0b86af10548fe0270f6d0db0
authorKevin Wolf <kwolf@redhat.com>
Mon, 31 Aug 2009 14:48:49 +0000 (31 16:48 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 9 Sep 2009 22:31:26 +0000 (9 17:31 -0500)
treefbb324e8752868bf8f0ba6ba15c01bbb9be47cda
parentea80b906f445969a5ccc781beb4e8bb7f60bbdbb
qcow2: Order concurrent AIO requests on the same unallocated cluster

When two AIO requests write to the same cluster, and this cluster is
unallocated, currently both requests allocate a new cluster and the second one
merges the first one when it is completed. This means an cluster allocation, a
read and a cluster deallocation which cause some overhead. If we simply let the
second request wait until the first one is done, we improve overall performance
with AIO requests (specifially, qcow2/virtio combinations).

This patch maintains a list of in-flight requests that have allocated new
clusters. A second request touching the same cluster is limited so that it
either doesn't touch the allocation of the first request (so it can have a
non-overlapping allocation) or it waits for the first request to complete.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/qcow2-cluster.c
block/qcow2.c
block/qcow2.h