summaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-10-27 12:48:55 +0200
committerFam Zheng <famz@redhat.com>2016-10-28 21:50:18 +0800
commit88b062c2036cfd05b5111147736a08ba05ea05a9 (patch)
treeb7018cd61ca309939b7197f7ad3ff729f9c0769d /block/block-backend.c
parent6653a73d12fbac8c9b5c22bb21aef22759b28c1c (diff)
downloadqemu-88b062c2036cfd05b5111147736a08ba05ea05a9.tar.gz
block: introduce BDRV_POLL_WHILE
We want the BDS event loop to run exclusively in the iothread that owns the BDS's AioContext. This macro will provide the synchronization between the two event loops; for now it just wraps the common idiom of a while loop around aio_poll. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-Id: <1477565348-5458-8-git-send-email-pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index bd6316c32a..27a7f6f523 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -878,7 +878,6 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
int64_t bytes, CoroutineEntry co_entry,
BdrvRequestFlags flags)
{
- AioContext *aio_context;
QEMUIOVector qiov;
struct iovec iov;
Coroutine *co;
@@ -900,11 +899,7 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
co = qemu_coroutine_create(co_entry, &rwco);
qemu_coroutine_enter(co);
-
- aio_context = blk_get_aio_context(blk);
- while (rwco.ret == NOT_DONE) {
- aio_poll(aio_context, true);
- }
+ BDRV_POLL_WHILE(blk_bs(blk), rwco.ret == NOT_DONE);
return rwco.ret;
}