qcow2: Order concurrent AIO requests on the same unallocated cluster
commitebeab049b0932903befaf678980df37e0d7dbe27
authorKevin Wolf <kwolf@redhat.com>
Mon, 31 Aug 2009 14:48:49 +0000 (31 16:48 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 23 Sep 2009 02:15:58 +0000 (22 21:15 -0500)
tree8f493f2011800acc4b34b12926cf84d8fdaaee4f
parentbbaadd3ef1ffea6fce6a7f379ec1ee519655ab92
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