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. */ > +void bdrv_aio_cancel_async(BlockDriverAIOCB *acb) > +{ > + if (acb->aiocb_info->cancel_async) { > + acb->aiocb_info->cancel_async(acb); > + } else { > + BlockDriverAIOCB *save = g_new(BlockDriverAIOCB, 1);
Please don't create a dummy BlockDriverAIOCB. It makes the code confusing because all other BlockDriverAIOCBs in QEMU are allocated with qemu_aio_get() and behave in a certain way. This is not really a BlockDriverAIOCB, it's just a struct to stash the old cb/opaque in.
pgpgNxz378G5I.pgp
Description: PGP signature