aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-10-03 18:14:16 +0200
committerKevin Wolf <kwolf@redhat.com>2016-10-07 13:34:07 +0200
commitfffb6e12233002c26c0ee9ff92fa87927cd779f2 (patch)
tree58513502dcb4fab664a02eb06b0751f8c8d2e913 /block/io.c
parent5b8bb3595a2941e9408021f1080e60ce86d677d2 (diff)
block: use aio_bh_schedule_oneshot
This simplifies bottom half handlers by removing calls to qemu_bh_delete and thus removing the need to stash the bottom half pointer in the opaque datum. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/block/io.c b/block/io.c
index 57a2eeb512..b136c89ae0 100644
--- a/block/io.c
+++ b/block/io.c
@@ -171,7 +171,6 @@ static void bdrv_drain_recurse(BlockDriverState *bs)
typedef struct {
Coroutine *co;
BlockDriverState *bs;
- QEMUBH *bh;
bool done;
} BdrvCoDrainData;
@@ -191,7 +190,6 @@ static void bdrv_co_drain_bh_cb(void *opaque)
BdrvCoDrainData *data = opaque;
Coroutine *co = data->co;
- qemu_bh_delete(data->bh);
bdrv_drain_poll(data->bs);
data->done = true;
qemu_coroutine_enter(co);
@@ -210,9 +208,9 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs)
.co = qemu_coroutine_self(),
.bs = bs,
.done = false,
- .bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_drain_bh_cb, &data),
};
- qemu_bh_schedule(data.bh);
+ aio_bh_schedule_oneshot(bdrv_get_aio_context(bs),
+ bdrv_co_drain_bh_cb, &data);
qemu_coroutine_yield();
/* If we are resumed from some other event (such as an aio completion or a
@@ -2095,7 +2093,6 @@ typedef struct BlockAIOCBCoroutine {
bool is_write;
bool need_bh;
bool *done;
- QEMUBH* bh;
} BlockAIOCBCoroutine;
static const AIOCBInfo bdrv_em_co_aiocb_info = {
@@ -2115,7 +2112,6 @@ static void bdrv_co_em_bh(void *opaque)
BlockAIOCBCoroutine *acb = opaque;
assert(!acb->need_bh);
- qemu_bh_delete(acb->bh);
bdrv_co_complete(acb);
}
@@ -2125,8 +2121,7 @@ static void bdrv_co_maybe_schedule_bh(BlockAIOCBCoroutine *acb)
if (acb->req.error != -EINPROGRESS) {
BlockDriverState *bs = acb->common.bs;
- acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);
- qemu_bh_schedule(acb->bh);
+ aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);
}
}