-----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJapqRMAAoJEJykq7OBq3PISrYIAKXc7psqt0A5f3Cz74IwvIiw hhcLGWdwA8tNYkTs/OU+xzwGPJYWgLbzvnday2FsfVuzJ0iYAPm/nCVtuMCS/ZFT hEAV7gvDU0VNwfDrVLwGiNf7mGqDBAlLdO1hUkth0kJ7URuqO8RVOSNuLWiKLYtv nHSpuZwGSM+eKfA4MB4GUR1zvg9cTTY0P9pCDK/1iUXxfP62xYbeC6SX55C2W50c nU0YeGw6gbAnX49AzwM/gDo5NOCAPct22p/9wy4KShiBWDkzf7+VBKUZ9wBle6xV wEGVDS4Iv1IrKN0KsnCcYDuylflrTC0mTeC4bN9UVAtqPnrnESobFQMuVMVOU44= =eDNN -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging # gpg: Signature made Mon 12 Mar 2018 16:01:16 GMT # gpg: using RSA key 9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: block: make BDRV_POLL_WHILE() re-entrancy safe Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
834eddf22e
@ -50,8 +50,8 @@
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Is the main loop waiting for a kick? Accessed with atomic ops. */
|
/* Number of waiting AIO_WAIT_WHILE() callers. Accessed with atomic ops. */
|
||||||
bool need_kick;
|
unsigned num_waiters;
|
||||||
} AioWait;
|
} AioWait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,9 +84,8 @@ typedef struct {
|
|||||||
} else { \
|
} else { \
|
||||||
assert(qemu_get_current_aio_context() == \
|
assert(qemu_get_current_aio_context() == \
|
||||||
qemu_get_aio_context()); \
|
qemu_get_aio_context()); \
|
||||||
assert(!wait_->need_kick); \
|
/* Increment wait_->num_waiters before evaluating cond. */ \
|
||||||
/* Set wait_->need_kick before evaluating cond. */ \
|
atomic_inc(&wait_->num_waiters); \
|
||||||
atomic_mb_set(&wait_->need_kick, true); \
|
|
||||||
while (busy_) { \
|
while (busy_) { \
|
||||||
if ((cond)) { \
|
if ((cond)) { \
|
||||||
waited_ = busy_ = true; \
|
waited_ = busy_ = true; \
|
||||||
@ -98,7 +97,7 @@ typedef struct {
|
|||||||
waited_ |= busy_; \
|
waited_ |= busy_; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
atomic_set(&wait_->need_kick, false); \
|
atomic_dec(&wait_->num_waiters); \
|
||||||
} \
|
} \
|
||||||
waited_; })
|
waited_; })
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ static void dummy_bh_cb(void *opaque)
|
|||||||
void aio_wait_kick(AioWait *wait)
|
void aio_wait_kick(AioWait *wait)
|
||||||
{
|
{
|
||||||
/* The barrier (or an atomic op) is in the caller. */
|
/* The barrier (or an atomic op) is in the caller. */
|
||||||
if (atomic_read(&wait->need_kick)) {
|
if (atomic_read(&wait->num_waiters)) {
|
||||||
aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, NULL);
|
aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user