summaryrefslogtreecommitdiff
path: root/block/qed-table.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/qed-table.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/qed-table.c')
-rw-r--r--block/qed-table.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/block/qed-table.c b/block/qed-table.c
index 1a731dff51..ed443e2b70 100644
--- a/block/qed-table.c
+++ b/block/qed-table.c
@@ -174,9 +174,7 @@ int qed_read_l1_table_sync(BDRVQEDState *s)
qed_read_table(s, s->header.l1_table_offset,
s->l1_table, qed_sync_cb, &ret);
- while (ret == -EINPROGRESS) {
- aio_poll(bdrv_get_aio_context(s->bs), true);
- }
+ BDRV_POLL_WHILE(s->bs, ret == -EINPROGRESS);
return ret;
}
@@ -195,9 +193,7 @@ int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index,
int ret = -EINPROGRESS;
qed_write_l1_table(s, index, n, qed_sync_cb, &ret);
- while (ret == -EINPROGRESS) {
- aio_poll(bdrv_get_aio_context(s->bs), true);
- }
+ BDRV_POLL_WHILE(s->bs, ret == -EINPROGRESS);
return ret;
}
@@ -268,9 +264,7 @@ int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset
int ret = -EINPROGRESS;
qed_read_l2_table(s, request, offset, qed_sync_cb, &ret);
- while (ret == -EINPROGRESS) {
- aio_poll(bdrv_get_aio_context(s->bs), true);
- }
+ BDRV_POLL_WHILE(s->bs, ret == -EINPROGRESS);
return ret;
}
@@ -290,9 +284,7 @@ int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request,
int ret = -EINPROGRESS;
qed_write_l2_table(s, request, index, n, flush, qed_sync_cb, &ret);
- while (ret == -EINPROGRESS) {
- aio_poll(bdrv_get_aio_context(s->bs), true);
- }
+ BDRV_POLL_WHILE(s->bs, ret == -EINPROGRESS);
return ret;
}