qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH 1/3] aio-context: if io_flush isn't provided, as


From: Anthony Liguori
Subject: [Qemu-devel] [RFC PATCH 1/3] aio-context: if io_flush isn't provided, assume "always busy"
Date: Thu, 28 Mar 2013 16:52:28 -0500

Today, all callers of qemu_aio_set_fd_handler() pass a valid io_flush
function.  However, the function allows the handler to be omitted
and the behavior is a bit strange.

It will still add the file descriptor to the GSource but it will
not consider the source to be "busy".  This could lead to aio_flush()
returning prematurely.

Since we never rely on this behavior today, it doesn't matter but
the next patch will start relying on an absent io_flush function
to assume the handler is always busy.

Cc: Paolo Bonzini <address@hidden>
Cc: Mike Roth <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
---
 aio-posix.c | 4 ++--
 aio-win32.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/aio-posix.c b/aio-posix.c
index b68eccd..a2349f6 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -208,8 +208,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
          * Otherwise, if there are no AIO requests, qemu_aio_wait() would
          * wait indefinitely.
          */
-        if (!node->deleted && node->io_flush) {
-            if (node->io_flush(node->opaque) == 0) {
+        if (!node->deleted) {
+            if (node->io_flush && node->io_flush(node->opaque) == 0) {
                 continue;
             }
             busy = true;
diff --git a/aio-win32.c b/aio-win32.c
index 38723bf..b02fd40 100644
--- a/aio-win32.c
+++ b/aio-win32.c
@@ -154,8 +154,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
          * Otherwise, if there are no AIO requests, qemu_aio_wait() would
          * wait indefinitely.
          */
-        if (!node->deleted && node->io_flush) {
-            if (node->io_flush(node->e) == 0) {
+        if (!node->deleted) {
+            if (node->io_flush && node->io_flush(node->e) == 0) {
                 continue;
             }
             busy = true;
-- 
1.8.0




reply via email to

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