From f2f364536e08045c34e48c8a57818998bde90bd2 Mon Sep 17 00:00:00 2001 From: Evgeny Kolmakov Date: Fri, 22 May 2026 11:06:44 +0300 Subject: [PATCH] block/io: Use QEMU_LOCK_GUARD to simplify mutex handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace qemu_mutex_(un)lock() calls with QEMU_LOCK_GUARD(). Signed-off-by: Evgeny Kolmakov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Zhang Chen Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev --- block/io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index 6c0bbdcf1e..a916b236c3 100644 --- a/block/io.c +++ b/block/io.c @@ -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; }