Mechanical conversion to QEMU_LOCK_GUARD
Subsystems (2)
cover Mechanical conversion to QEMU_LOCK_GUARD
This trivial series replaces manual qemu_mutex_(un)lock() calls with the safer QEMU_LOCK_GUARD() macro in
net/colo-compare.c: colo_notify_compares_event(), block/io.c: bdrv_co_get_self_request().
Evgeny Kolmakov (2):
net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling block/io: Use QEMU_LOCK_GUARD to simplify mutex handling
block/io.c | 4 +--- net/colo-compare.c | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
Replace qemu_mutex_(un)lock() calls with the QEMU_LOCK_GUARD().
--- net/colo-compare.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
net/colo-compare.c +2 -6
@@ -902,14 +902,13 @@ static void check_old_packet_regular(void *opaque)void colo_notify_compares_event (void *opaque,int event,Error **errp) {CompareState *s; -qemu_mutex_lock (&colo_compare_mutex); +QEMU_LOCK_GUARD (&colo_compare_mutex);if (!colo_compare_active) { -qemu_mutex_unlock (&colo_compare_mutex);return ; } -qemu_mutex_lock (&event_mtx); +QEMU_LOCK_GUARD (&event_mtx); QTAILQ_FOREACH(s, &net_compares, next) { s->event = event;qemu_bh_schedule (s->event_bh);
@@ -919,9 +918,6 @@ void colo_notify_compares_event(void *opaque, int event, Error **errp)while (event_unhandled_count >0 ) {qemu_cond_wait (&event_complete_cond, &event_mtx); } - -qemu_mutex_unlock (&event_mtx); -qemu_mutex_unlock (&colo_compare_mutex); }static void colo_compare_timer_init (CompareState *s)
Signature · 1 line
2.43.0
Re: [PATCH 1/2] net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
Quoted 6 lines · Evgeny Kolmakov
Replace qemu_mutex_(un)lock() calls with the
QEMU_LOCK_GUARD().Signed-off-by Evgeny Kolmakov <[email protected]>--- net/colo-compare.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
PATCH 2/2 block/io: Use QEMU_LOCK_GUARD to simplify mutex handling
In reply to Evgeny KolmakovReplace qemu_mutex_(un)lock() calls with QEMU_LOCK_GUARD().
--- block/io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/io.c +1 -3
@@ -719,14 +719,12 @@ BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs)Coroutine *self =qemu_coroutine_self ();IO_CODE (); -qemu_mutex_lock (&bs->reqs_lock); +QEMU_LOCK_GUARD (&bs->reqs_lock); QLIST_FOREACH(req, &bs->tracked_requests, list) {if (req->co == self) { -qemu_mutex_unlock (&bs->reqs_lock);return req; } } -qemu_mutex_unlock (&bs->reqs_lock);return NULL ; }
Signature · 1 line
2.43.0
Re: [PATCH 2/2] block/io: Use QEMU_LOCK_GUARD to simplify mutex handling
Quoted 6 lines · Evgeny Kolmakov
Replace qemu_mutex_(un)lock() calls with
QEMU_LOCK_GUARD().Signed-off-by Evgeny Kolmakov <[email protected]>--- block/io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 6 lines · Evgeny Kolmakov
This trivial series replaces manual qemu_mutex_(un)lock() calls with the safer
QEMU_LOCK_GUARD()macro in
net/colo-compare.c:colo_notify_compares_event(),block/io.c:bdrv_co_get_self_request().
Quoted 8 lines
Evgeny Kolmakov (2):
net/colo-compare: UseQEMU_LOCK_GUARDto simplify mutex handling block/io: UseQEMU_LOCK_GUARDto simplify mutex handlingblock/io.c | 4 +--- net/colo-compare.c | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-)
LGTM.
For this series:
Quoted 3 lines
--
2.43.0