Bläddra i källkod

iothread: document about why we need explicit aio_poll()

After consulting Paolo I know why we'd better keep the explicit
aio_poll() in iothread_run().  Document it directly into the code so
that future readers will know the answer from day one.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 2019030611.23025-6-peterx@redhat.com
Message-Id: <2019030611.23025-6-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
tags/v4.0.0-rc0
Peter Xu 4 månader sedan
förälder
incheckning
6ca206204f
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9
    0
      iothread.c

+ 9
- 0
iothread.c Visa fil

@@ -63,6 +63,15 @@ static void *iothread_run(void *opaque)
63 63
     qemu_sem_post(&iothread->init_done_sem);
64 64
 
65 65
     while (iothread->running) {
66
+        /*
67
+         * Note: from functional-wise the g_main_loop_run() below can
68
+         * already cover the aio_poll() events, but we can't run the
69
+         * main loop unconditionally because explicit aio_poll() here
70
+         * is faster than g_main_loop_run() when we do not need the
71
+         * gcontext at all (e.g., pure block layer iothreads).  In
72
+         * other words, when we want to run the gcontext with the
73
+         * iothread we need to pay some performance for functionality.
74
+         */
66 75
         aio_poll(iothread->ctx, true);
67 76
 
68 77
         /*

Laddar…
Avbryt
Spara