mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
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>
This commit is contained in:
parent
6653a73d12
commit
88b062c203
4 changed files with 19 additions and 50 deletions
|
@ -334,6 +334,15 @@ void bdrv_drain(BlockDriverState *bs);
|
|||
void coroutine_fn bdrv_co_drain(BlockDriverState *bs);
|
||||
void bdrv_drain_all(void);
|
||||
|
||||
#define BDRV_POLL_WHILE(bs, cond) ({ \
|
||||
bool waited_ = false; \
|
||||
BlockDriverState *bs_ = (bs); \
|
||||
while ((cond)) { \
|
||||
aio_poll(bdrv_get_aio_context(bs_), true); \
|
||||
waited_ = true; \
|
||||
} \
|
||||
waited_; })
|
||||
|
||||
int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count);
|
||||
int bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int count);
|
||||
int bdrv_has_zero_init_1(BlockDriverState *bs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue