aboutsummaryrefslogtreecommitdiff
path: root/include/block/aio-wait.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/block/aio-wait.h')
-rw-r--r--include/block/aio-wait.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
index c85a62f798..600fad183e 100644
--- a/include/block/aio-wait.h
+++ b/include/block/aio-wait.h
@@ -76,6 +76,8 @@ typedef struct {
bool waited_ = false; \
AioWait *wait_ = (wait); \
AioContext *ctx_ = (ctx); \
+ /* Increment wait_->num_waiters before evaluating cond. */ \
+ atomic_inc(&wait_->num_waiters); \
if (ctx_ && in_aio_context_home_thread(ctx_)) { \
while ((cond)) { \
aio_poll(ctx_, true); \
@@ -84,8 +86,6 @@ typedef struct {
} else { \
assert(qemu_get_current_aio_context() == \
qemu_get_aio_context()); \
- /* Increment wait_->num_waiters before evaluating cond. */ \
- atomic_inc(&wait_->num_waiters); \
while ((cond)) { \
if (ctx_) { \
aio_context_release(ctx_); \
@@ -96,8 +96,8 @@ typedef struct {
} \
waited_ = true; \
} \
- atomic_dec(&wait_->num_waiters); \
} \
+ atomic_dec(&wait_->num_waiters); \
waited_; })
/**