diff mbox series

[RFC,3/4] hw/scsi/scsi-generic: Use automatic AIO context lock

Message ID 20211005185807.4134557-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series aio: AIO_CONTEXT_ACQUIRE_GUARD() macro experiment | expand

Commit Message

Philippe Mathieu-Daudé Oct. 5, 2021, 6:58 p.m. UTC
Use the automatic AIO context acquire/release in
scsi_command_complete().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/scsi/scsi-generic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 665baf900e4..08ef623c030 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -114,9 +114,9 @@  static void scsi_command_complete(void *opaque, int ret)
     assert(r->req.aiocb != NULL);
     r->req.aiocb = NULL;
 
-    aio_context_acquire(blk_get_aio_context(s->conf.blk));
-    scsi_command_complete_noio(r, ret);
-    aio_context_release(blk_get_aio_context(s->conf.blk));
+    WITH_AIO_CONTEXT_ACQUIRE_GUARD(blk_get_aio_context(s->conf.blk)) {
+        scsi_command_complete_noio(r, ret);
+    }
 }
 
 static int execute_command(BlockBackend *blk,