On Fri, 08/22 12:10, Paolo Bonzini wrote:
> Il 22/08/2014 11:37, Fam Zheng ha scritto:
> > Exactly. I'd rather not change the contract then.
> >
> > Alternatively, we may add a refcnt field to BlockDriverAioCB and grab one
> > before
> > calling .cancel, so the qemu_aio_release will not free it.
Il 22/08/2014 11:37, Fam Zheng ha scritto:
> Exactly. I'd rather not change the contract then.
>
> Alternatively, we may add a refcnt field to BlockDriverAioCB and grab one
> before
> calling .cancel, so the qemu_aio_release will not free it.
Yes, and I don't exclude that sooner or later we'll h
On Fri, 08/22 10:14, Paolo Bonzini wrote:
> Il 22/08/2014 03:23, Fam Zheng ha scritto:
> > What about we save cb and opaque locally, and set acb->cb to a nop. When
> > cancel
> > is done we can call the original cb?
>
> That might work but needs some auditing. Right now the AIOCB is still
> vali
Il 22/08/2014 03:23, Fam Zheng ha scritto:
> What about we save cb and opaque locally, and set acb->cb to a nop. When
> cancel
> is done we can call the original cb?
That might work but needs some auditing. Right now the AIOCB is still
valid when the callback is called, and this would be changed
On Thu, 08/21 14:14, Paolo Bonzini wrote:
> Il 21/08/2014 13:56, Fam Zheng ha scritto:
> > +BlockDriverAIOCB *save = g_new(BlockDriverAIOCB, 1);
> > +save->cb = acb->cb;
> > +save->opaque = acb->opaque;
> > +acb->cb= bdrv_aio_c
On Thu, Aug 21, 2014 at 07:56:48PM +0800, Fam Zheng wrote:
> +/* Async version of aio cancel. The caller is not blocked if the acb
> implements
> + * cancel_async, otherwise fall back to bdrv_aio_cancel. In both cases,
> acb->cb
> + * is guarenteed to be called, before or after function returns.
Il 21/08/2014 13:56, Fam Zheng ha scritto:
> +BlockDriverAIOCB *save = g_new(BlockDriverAIOCB, 1);
> +save->cb = acb->cb;
> +save->opaque = acb->opaque;
> +acb->cb= bdrv_aio_cancel_async_cb;
> +acb->opaque=
This is the async version of bdrv_aio_cancel, which doesn't block the
caller. It guarantees that the cb is called either before returning or
some time later.
Signed-off-by: Fam Zheng
---
block.c | 35 +++
include/block/aio.h | 2 ++
include/block/