From d7c99a1282ca2de1c344b8aa91be5364e9c6aa8f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 12 Jan 2017 19:07:53 +0100 Subject: 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 Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng Message-id: 20170112180800.21085-4-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi --- include/block/aio.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/block/aio.h b/include/block/aio.h index 013d4002f6..be3adfec43 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -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 -- cgit v1.2.3