Received: from eggs.gnu.org ([208.118.235.92]:57122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKkb-00012N-0U for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:52:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULKkY-0003CV-Rl for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:52:48 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:38137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKkY-0003Bs-B0 for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:52:46 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Mar 2013 07:45:42 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 683302CE804A for ; Fri, 29 Mar 2013 08:52:38 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2SLqWfY197040 for ; Fri, 29 Mar 2013 08:52:33 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2SLqarZ002056 for ; Fri, 29 Mar 2013 08:52:36 +1100 From: Anthony Liguori Date: Thu, 28 Mar 2013 16:52:28 -0500 Message-Id: <1364507550-25093-2-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1364507550-25093-1-git-send-email-aliguori@us.ibm.com> References: <1364507550-25093-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [RFC PATCH 1/3] aio-context: if io_flush isn't provided, assume "always busy" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Anthony Liguori , Mike Roth Paolo Bonzini 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 Cc: Mike Roth Signed-off-by: Anthony Liguori --- 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