Re: [Qemu-devel] [PATCH 02/18] blockjob: introduce .drain callback for jobs

2016-10-17 Thread Paolo Bonzini
On 16/10/2016 12:02, Stefan Hajnoczi wrote: > On Thu, Oct 13, 2016 at 07:34:06PM +0200, Paolo Bonzini wrote: >> +static void backup_drain(BlockJob *job) >> +{ >> +BackupBlockJob *s = container_of(job, BackupBlockJob, common); >> + >> +/* Need to keep a reference in case blk_drain

[Qemu-devel] [PATCH 02/18] blockjob: introduce .drain callback for jobs

2016-10-13 Thread Paolo Bonzini
This is required to decouple block jobs from running in an AioContext. With multiqueue block devices, a BlockDriverState does not really belong to a single AioContext. The solution is to first wait until all I/O operations are complete; then loop in the main thread for the block job to complete