diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-03 18:14:16 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-10-07 13:34:07 +0200 |
commit | fffb6e12233002c26c0ee9ff92fa87927cd779f2 (patch) | |
tree | 58513502dcb4fab664a02eb06b0751f8c8d2e913 /blockjob.c | |
parent | 5b8bb3595a2941e9408021f1080e60ce86d677d2 (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 'blockjob.c')
-rw-r--r-- | blockjob.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/blockjob.c b/blockjob.c index a167f96fd4..43fecbe13e 100644 --- a/blockjob.c +++ b/blockjob.c @@ -588,7 +588,6 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err, typedef struct { BlockJob *job; - QEMUBH *bh; AioContext *aio_context; BlockJobDeferToMainLoopFn *fn; void *opaque; @@ -599,8 +598,6 @@ static void block_job_defer_to_main_loop_bh(void *opaque) BlockJobDeferToMainLoopData *data = opaque; AioContext *aio_context; - qemu_bh_delete(data->bh); - /* Prevent race with block_job_defer_to_main_loop() */ aio_context_acquire(data->aio_context); @@ -624,13 +621,13 @@ void block_job_defer_to_main_loop(BlockJob *job, { BlockJobDeferToMainLoopData *data = g_malloc(sizeof(*data)); data->job = job; - data->bh = qemu_bh_new(block_job_defer_to_main_loop_bh, data); data->aio_context = blk_get_aio_context(job->blk); data->fn = fn; data->opaque = opaque; job->deferred_to_main_loop = true; - qemu_bh_schedule(data->bh); + aio_bh_schedule_oneshot(qemu_get_aio_context(), + block_job_defer_to_main_loop_bh, data); } BlockJobTxn *block_job_txn_new(void) |