From patchwork Tue Sep 25 12:56:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 186823 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 CE1AD2C0081 for ; Wed, 26 Sep 2012 00:00:31 +1000 (EST) Received: from localhost ([::1]:36608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGUha-0005A6-Tv for incoming@patchwork.ozlabs.org; Tue, 25 Sep 2012 08:57:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGUhE-0004e3-Cx for qemu-devel@nongnu.org; Tue, 25 Sep 2012 08:57:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGUhD-0001BH-91 for qemu-devel@nongnu.org; Tue, 25 Sep 2012 08:57:04 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:47717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGUhD-0000zM-2b for qemu-devel@nongnu.org; Tue, 25 Sep 2012 08:57:03 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so2197543pad.4 for ; Tue, 25 Sep 2012 05:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=RaevtiDLrq7elJp1Z66V+RIpIiHUx7rn2ujuWC69Pz4=; b=sW6d7ADhCy6Dd/HcKjhrZQh/yVk+CgdWRkD5pMPpfBbEiKCHaFRCDiUvXt9z0yKmJ4 si+xMC29im71LblYCj5v6mlGbA7xZSG3ChPrdw+tkovWidtybSEQIKcFcXjtfCd48YRw v68gO8erKI9KTqRLCb+Fykmw63HdwQLwrImYl793n26/UoSUiQS3i9wIpLFI6Cmaxba7 ZRGtj0D+kBl2IRVM+0SUsfnNd/OW+MbecrLkEQQtaDzsIlqInhDn4ua8FNDx1guRrJ5h Fq5lQUCP2KBUf5/QsDNaPw1TsuvTr9B+oWAksH2GuX4hZdmP3ZcuziPhzcFXewsRjdaE a9Pw== Received: by 10.68.224.132 with SMTP id rc4mr16480422pbc.155.1348577822630; Tue, 25 Sep 2012 05:57: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 py9sm309335pbb.20.2012.09.25.05.56.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 05:57:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2012 14:56:02 +0200 Message-Id: <1348577763-12920-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1348577763-12920-1-git-send-email-pbonzini@redhat.com> References: <1348577763-12920-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.220.45 Subject: [Qemu-devel] [PATCH 16/17] 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. Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori --- 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 31c6c76..5a96d11 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 ac44657..1ea6ea3 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -219,7 +219,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