qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/14] block/nbd: refactor connect_bh()


From: Vladimir Sementsov-Ogievskiy
Subject: [PATCH 11/14] block/nbd: refactor connect_bh()
Date: Wed, 7 Apr 2021 13:46:34 +0300

Now it's just a wrapper for aio_co_wake(). Make it more obvious.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/nbd.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/block/nbd.c b/block/nbd.c
index 29bdbd38b6..6729561935 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -362,11 +362,9 @@ static void nbd_init_connect_thread(BlockDriverState *bs)
     qemu_mutex_init(&s->connect_thread->mutex);
 }
 
-static void connect_bh(void *opaque)
+static void coroutine_wake_bh(void *opaque)
 {
-    BDRVNBDState *state = opaque;
-
-    aio_co_wake(state->connection_co);
+    aio_co_wake(opaque);
 }
 
 static void connect_thread_cb(QIOChannelSocket *sioc, int ret, void *opaque)
@@ -403,7 +401,8 @@ static void connect_thread_cb(QIOChannelSocket *sioc, int 
ret, void *opaque)
          * Direct call to aio_co_wake() from thread context works bad. So use
          * aio_bh_schedule_oneshot() as a mediator.
          */
-        aio_bh_schedule_oneshot(bdrv_get_aio_context(thr->bs), connect_bh, s);
+        aio_bh_schedule_oneshot(bdrv_get_aio_context(thr->bs),
+                                coroutine_wake_bh, s->connection_co);
     }
 
     if (do_free) {
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]