[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 29/39] aio: clean up now-unused functions
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 29/39] aio: clean up now-unused functions |
Date: |
Wed, 31 Oct 2012 16:30:46 +0100 |
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
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 <sys/syscall.h>
#endif
-#ifdef CONFIG_EVENTFD
-#include <sys/eventfd.h>
-#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
--
1.7.12.1
- [Qemu-devel] [PATCH v2 11/39] build: opts-visitor is not really part of QAPI, (continued)
- [Qemu-devel] [PATCH v2 11/39] build: opts-visitor is not really part of QAPI, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 12/39] build: do not include main loop where it is not actually used, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 17/39] aio: provide platform-independent API, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 20/39] aio: test node->deleted before calling io_flush, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 21/39] aio: add non-blocking variant of aio_wait, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 23/39] aio: add Win32 implementation, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 22/39] aio: prepare for introducing GSource-based dispatch, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 25/39] aio: add aio_notify, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 24/39] aio: make AioContexts GSources, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 27/39] main-loop: use GSource to poll AIO file descriptors, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 29/39] aio: clean up now-unused functions,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 33/39] threadpool: do not take lock in event_notifier_ready, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 32/39] aio: add generic thread-pool facility, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 34/39] block: switch posix-aio-compat to threadpool, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 35/39] raw: merge posix-aio-compat.c into block/raw-posix.c, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 36/39] raw-posix: rename raw-posix-aio.h, hide unavailable prototypes, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 37/39] raw-win32: add emulated AIO support, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 30/39] linux-aio: use event notifiers, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 14/39] event_notifier: enable it to use pipes, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier, Paolo Bonzini, 2012/10/31
- [Qemu-devel] [PATCH v2 31/39] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/10/31