From patchwork Wed Oct 31 15:30:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 195965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 238CA2C0082 for ; Thu, 1 Nov 2012 04:45:54 +1100 (EST) Received: from localhost ([::1]:33683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTaIN-0001OF-6L for incoming@patchwork.ozlabs.org; Wed, 31 Oct 2012 11:33:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTaI5-00011H-4L for qemu-devel@nongnu.org; Wed, 31 Oct 2012 11:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTaHu-0005fi-Ty for qemu-devel@nongnu.org; Wed, 31 Oct 2012 11:33:12 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:41123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTaHu-0004ui-O6 for qemu-devel@nongnu.org; Wed, 31 Oct 2012 11:33:02 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so1021969pbb.4 for ; Wed, 31 Oct 2012 08:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=f6yXPtW+CtbCrv9hmcevUi2Q+lK72YEnl6QOieGB7vU=; b=dKN6VsL/EWEnXI4VYzTlww/yp1b91ydiX3ay1+rsdyOQwV1p5D1+IKCJ5XjJJNTM1/ DxzMiZaRQcrh7YFFBy+he7zaSvkfemv5e1mP5SrtEOBEPJOc3SKJjkpHlgUKFEtxPcpB Ai/PcrB1uihyvPJcJA/f3oDmIEn4kXX1x2OBrYZ2drOPZagluknce4OkjzNnMOGaTqBL izKYGu5e+6mOTm0lcPr9SCnYf+B3H8DKwzhVc8TfsXmio2+S+z7fsuvkgvHCNwfxe0fV zTaQGm1B2ZbZXhnWPgWUB14PVfd1wdVROlPrZTWfSCxJhNyp8/I5WH90E8DMgjbXqZvl N9vw== Received: by 10.68.244.135 with SMTP id xg7mr5581059pbc.87.1351697582222; Wed, 31 Oct 2012 08:33:02 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id sz6sm2445230pbc.52.2012.10.31.08.32.58 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 31 Oct 2012 08:33:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2012 16:30:46 +0100 Message-Id: <1351697456-16107-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1351697456-16107-1-git-send-email-pbonzini@redhat.com> References: <1351697456-16107-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 29/39] aio: clean up now-unused functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Some cleanups can now be made, now that the main loop does not anymore need hooks into the bottom half code. Reviewed-by: Anthony Liguori Signed-off-by: Paolo Bonzini --- async.c | 23 +++++++---------------- oslib-posix.c | 31 ------------------------------- qemu-aio.h | 1 - qemu-common.h | 1 - 4 file modificati, 7 inserzioni(+), 49 rimozioni(-) diff --git a/async.c b/async.c index 564526f..04f9dcb 100644 --- a/async.c +++ b/async.c @@ -117,16 +117,20 @@ void qemu_bh_delete(QEMUBH *bh) bh->deleted = 1; } -void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout) +static gboolean +aio_ctx_prepare(GSource *source, gint *timeout) { + AioContext *ctx = (AioContext *) source; QEMUBH *bh; + bool scheduled = false; for (bh = ctx->first_bh; bh; bh = bh->next) { if (!bh->deleted && bh->scheduled) { + scheduled = true; if (bh->idle) { /* idle bottom halves will be polled at least * every 10ms */ - *timeout = MIN(10, *timeout); + *timeout = 10; } else { /* non-idle bottom halves will be executed * immediately */ @@ -135,21 +139,8 @@ void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout) } } } -} - -static gboolean -aio_ctx_prepare(GSource *source, gint *timeout) -{ - AioContext *ctx = (AioContext *) source; - uint32_t wait = -1; - aio_bh_update_timeout(ctx, &wait); - - if (wait != -1) { - *timeout = MIN(*timeout, wait); - return wait == 0; - } - return false; + return scheduled; } static gboolean diff --git a/oslib-posix.c b/oslib-posix.c index dbeb627..9db9c3d 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -61,9 +61,6 @@ static int running_on_valgrind = -1; #ifdef CONFIG_LINUX #include #endif -#ifdef CONFIG_EVENTFD -#include -#endif int qemu_get_thread_id(void) { @@ -183,34 +180,6 @@ int qemu_pipe(int pipefd[2]) return ret; } -/* - * Creates an eventfd that looks like a pipe and has EFD_CLOEXEC set. - */ -int qemu_eventfd(int fds[2]) -{ -#ifdef CONFIG_EVENTFD - int ret; - - ret = eventfd(0, 0); - if (ret >= 0) { - fds[0] = ret; - fds[1] = dup(ret); - if (fds[1] == -1) { - close(ret); - return -1; - } - qemu_set_cloexec(ret); - qemu_set_cloexec(fds[1]); - return 0; - } - if (errno != ENOSYS) { - return -1; - } -#endif - - return qemu_pipe(fds); -} - int qemu_utimens(const char *path, const struct timespec *times) { struct timeval tv[2], tv_now; diff --git a/qemu-aio.h b/qemu-aio.h index 2354617..1b7eb6e 100644 --- a/qemu-aio.h +++ b/qemu-aio.h @@ -125,7 +125,6 @@ void aio_notify(AioContext *ctx); * These are internal functions used by the QEMU main loop. */ int aio_bh_poll(AioContext *ctx); -void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout); /** * qemu_bh_schedule: Schedule a bottom half. diff --git a/qemu-common.h b/qemu-common.h index 24e13cc..c3328d2 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -218,7 +218,6 @@ ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) QEMU_WARN_UNUSED_RESULT; #ifndef _WIN32 -int qemu_eventfd(int pipefd[2]); int qemu_pipe(int pipefd[2]); #endif