On 08/11/2011 04:37 PM, Kevin Wolf wrote:
>  Right, I would rather update BlockDriverCompletionFunc to pass the AIOCB
>  as a third parameter, and store the residual bytes in the DMAAIOCB (with
>  a getter that the completion function can use).

Isn't the DMAAIOCB already passed as opaque to the callback?

It is passed to the dma_bdrv_cb, but not to the caller-provided callback. If the operation completes before dma_bdrv_{read,write} returns, the AIOCB is not stored anywhere and the asynchronous callback does not have access to it. Usually it does not have anything to do with it, but in this case it could get the residual.

Another possibility is always completing DMA in a bottom half. This ensures that the callback can access the AIOCB, but it exposes an implementation detail to the caller, so I don't like it.

Paolo

Reply via email to