QEMU-Trivial Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeny Kolmakov <randomjack94dev@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, stefanha@redhat.com, fam@euphon.net,
	kwolf@redhat.com, hreitz@redhat.com, zhangckid@gmail.com,
	lizhijian@fujitsu.com, jasowang@redhat.com,
	Evgeny Kolmakov <randomjack94dev@gmail.com>
Subject: [PATCH 2/2] block/io: Use QEMU_LOCK_GUARD to simplify mutex handling
Date: Fri, 22 May 2026 11:06:44 +0300	[thread overview]
Message-ID: <20260522080644.9531-3-randomjack94dev@gmail.com> (raw)
In-Reply-To: <20260522080644.9531-1-randomjack94dev@gmail.com>

Replace qemu_mutex_(un)lock() calls with QEMU_LOCK_GUARD().

Signed-off-by: Evgeny Kolmakov <randomjack94dev@gmail.com>
---
 block/io.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/io.c b/block/io.c
index e8fb4ede4d..1020047888 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;
 }
-- 
2.43.0



  parent reply	other threads:[~2026-05-22 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  8:06 [PATCH 0/2] Mechanical conversion to QEMU_LOCK_GUARD Evgeny Kolmakov
2026-05-22  8:06 ` [PATCH 1/2] net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling Evgeny Kolmakov
2026-05-26  7:46   ` Philippe Mathieu-Daudé
2026-05-22  8:06 ` Evgeny Kolmakov [this message]
2026-05-26  7:46   ` [PATCH 2/2] block/io: " Philippe Mathieu-Daudé
2026-05-25 11:45 ` [PATCH 0/2] Mechanical conversion to QEMU_LOCK_GUARD Zhang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522080644.9531-3-randomjack94dev@gmail.com \
    --to=randomjack94dev@gmail.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=zhangckid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox