> > I currently use qemu_aio_set_fd_handler() to implement async output to > > the backup stream. While that works, performance is much better > > (during backup) if I use a separate thread to write the data. > > > > Is that known behavior, or should aio give about the same performance > > as using a thread? > > It depends, but this is what we saw for migration too. You may also have > less contention on the big QEMU lock if you use a thread.
But when I use a thread it triggers the bug in bdrv_drain_all(). So how can I fix bdrv_drain_all() if I use a separate thread to write data? I currently use CoQueue to wait for the output thread. Maybe there is some example code somewhere? > > Or would I get better performance if I use Linux native AIO support? > > That also depends, but in general it should be faster. Is there an easy way to switch to native AIO? The code in block/linux-aio.c is only usable inside block drivers? I simply need to write to a unix file descriptor.