aio: make ctx->list_lock a QemuLockCnt, subsuming ctx->walking_bh

This will make it possible to walk the list of bottom halves without
holding the AioContext lock---and in turn to call bottom half
handlers without holding the lock.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20170112180800.21085-4-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Paolo Bonzini 2017-01-12 19:07:53 +01:00 committed by Stefan Hajnoczi
parent 51dee5e465
commit d7c99a1282
2 changed files with 21 additions and 26 deletions

View file

@ -90,17 +90,15 @@ struct AioContext {
*/
uint32_t notify_me;
/* lock to protect between bh's adders and deleter */
QemuMutex list_lock;
/* A lock to protect between bh's adders and deleter, and to ensure
* that no callbacks are removed while we're walking and dispatching
* them.
*/
QemuLockCnt list_lock;
/* Anchor of the list of Bottom Halves belonging to the context */
struct QEMUBH *first_bh;
/* A simple lock used to protect the first_bh list, and ensure that
* no callbacks are removed while we're walking and dispatching callbacks.
*/
int walking_bh;
/* Used by aio_notify.
*
* "notified" is used to avoid expensive event_notifier_test_and_clear