On Thu, Nov 16, 2017 at 3:12 PM, Richard W.M. Jones <rjo...@redhat.com> wrote: > On Thu, Nov 16, 2017 at 03:51:29PM +0100, Peter Lieven wrote: >> Afaik all writes to the same QCOW2 serialize because of the s->lock that >> is held during the write. So its not suprising that there is no benefit from >> mutliple threads as long as reading from the RAW file involves no delay. >> Which is likely due to readahead of the OS. > > I guess this would explain it, thanks.
The theory is false for preallocated qcow2 image files. Parallel writes do occur in block/qcow2.c:qcow2_co_pwritev() if the cluster is already allocated: qemu_co_mutex_unlock(&s->lock); <----- parallel! BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); trace_qcow2_writev_data(qemu_coroutine_self(), cluster_offset + offset_in_cluster); ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster, cur_bytes, &hd_qiov, 0); qemu_co_mutex_lock(&s->lock); Stefan