aboutsummaryrefslogtreecommitdiff
path: root/dma-helpers.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-06-20 20:36:57 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2016-06-28 13:08:31 +0100
commit5fa78b2a1ca228255cb4a492ebf16cbb8d80c111 (patch)
tree6bf0b8de92ef952f2e118eede00dc93c3ac538db /dma-helpers.c
parent17c42b1f6bc22c64e36b7172990ac65f00be173b (diff)
dma-helpers: dma_blk_io() cancel support
Attempting to cancel a dma_blk_io() request causes an abort(3): void bdrv_aio_cancel(BlockAIOCB *acb) { ... while (acb->refcnt > 1) { if (acb->aiocb_info->get_aio_context) { aio_poll(acb->aiocb_info->get_aio_context(acb), true); } else if (acb->bs) { aio_poll(bdrv_get_aio_context(acb->bs), true); } else { abort(); } } ... } This happens because DMAAIOCB->bs is NULL and dma_aiocb_info.get_aio_context() is also NULL. This patch trivially implements dma_aiocb_info.get_aio_context() by fetching the DMAAIOCB->ctx field. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1466451417-27988-1-git-send-email-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'dma-helpers.c')
-rw-r--r--dma-helpers.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dma-helpers.c b/dma-helpers.c
index b521d84ebd..9defc101b7 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -185,10 +185,17 @@ static void dma_aio_cancel(BlockAIOCB *acb)
}
}
+static AioContext *dma_get_aio_context(BlockAIOCB *acb)
+{
+ DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
+
+ return dbs->ctx;
+}
static const AIOCBInfo dma_aiocb_info = {
.aiocb_size = sizeof(DMAAIOCB),
.cancel_async = dma_aio_cancel,
+ .get_aio_context = dma_get_aio_context,
};
BlockAIOCB *dma_blk_io(AioContext *ctx,