summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorStefan Hajnoczi2014-05-08 16:34:51 +0200
committerStefan Hajnoczi2014-06-04 09:56:12 +0200
commitea8001914924331549e9b876bcaeac2dc80db2b6 (patch)
tree4b21354f87a878b5304aa97d6e0c6e6a4c3832b2 /block
parentblock/raw-win32: implement .bdrv_detach/attach_aio_context() (diff)
downloadqemu-ea8001914924331549e9b876bcaeac2dc80db2b6.tar.gz
qemu-ea8001914924331549e9b876bcaeac2dc80db2b6.tar.xz
qemu-ea8001914924331549e9b876bcaeac2dc80db2b6.zip
rbd: use BlockDriverState's AioContext
Drop the assumption that we're using the main AioContext. Convert qemu_bh_new() to aio_bh_new() and qemu_aio_wait() to aio_poll(). The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces are not needed since no fd handlers, timers, or BHs stay registered when requests have been drained. Cc: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'block')
-rw-r--r--block/rbd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/rbd.c b/block/rbd.c
index 09af48426e..a78760b7fe 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -555,7 +555,7 @@ static void qemu_rbd_aio_cancel(BlockDriverAIOCB *blockacb)
acb->cancelled = 1;
while (acb->status == -EINPROGRESS) {
- qemu_aio_wait();
+ aio_poll(bdrv_get_aio_context(acb->common.bs), true);
}
qemu_aio_release(acb);
@@ -588,7 +588,8 @@ static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb)
rcb->ret = rbd_aio_get_return_value(c);
rbd_aio_release(c);
- acb->bh = qemu_bh_new(rbd_finish_bh, rcb);
+ acb->bh = aio_bh_new(bdrv_get_aio_context(acb->common.bs),
+ rbd_finish_bh, rcb);
qemu_bh_schedule(acb->bh);
}