Re: [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async

2014-08-26 Thread Paolo Bonzini
Il 26/08/2014 11:21, Fam Zheng ha scritto: > On Tue, 08/26 10:46, Paolo Bonzini wrote: >> Il 26/08/2014 08:08, Fam Zheng ha scritto: >>> +if (dbs->cancelled) { >>> +ret = -ECANCELED; >>> +} >> >> Why is dbs->cancelled necessary? > > Request may complete after bdrv_aio_cancel_async

Re: [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async

2014-08-26 Thread Fam Zheng
On Tue, 08/26 10:46, Paolo Bonzini wrote: > Il 26/08/2014 08:08, Fam Zheng ha scritto: > > +if (dbs->cancelled) { > > +ret = -ECANCELED; > > +} > > Why is dbs->cancelled necessary? Request may complete after bdrv_aio_cancel_async with other status, this flag is checked to fix the

Re: [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async

2014-08-26 Thread Paolo Bonzini
Il 26/08/2014 08:08, Fam Zheng ha scritto: > +if (dbs->cancelled) { > +ret = -ECANCELED; > +} Why is dbs->cancelled necessary? > dma_bdrv_unmap(dbs); > if (dbs->common.cb) { > dbs->common.cb(dbs->common.opaque, ret); > @@ -141,6 +148,9 @@ static void dma_bdrv_cb

[Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async

2014-08-25 Thread Fam Zheng
Just forward the request to bdrv_aio_cancel_async. Use a flag to fix the ret value in completion code. Also check memory address before calling dma_memory_unmap. Signed-off-by: Fam Zheng --- dma-helpers.c | 28 1 file changed, 28 insertions(+) diff --git a/dma-helpe