aio.h (02b351d8466a26c93bf35ff8fd5c316e6aee8c0f) aio.h (0c330a734b51c177ab8488932ac3b0c4d63a718a)
1/*
2 * QEMU aio implementation
3 *
4 * Copyright IBM, Corp. 2008
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 33 unchanged lines hidden (view full) ---

42void qemu_aio_unref(void *p);
43void qemu_aio_ref(void *p);
44
45typedef struct AioHandler AioHandler;
46typedef void QEMUBHFunc(void *opaque);
47typedef bool AioPollFn(void *opaque);
48typedef void IOHandler(void *opaque);
49
1/*
2 * QEMU aio implementation
3 *
4 * Copyright IBM, Corp. 2008
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 33 unchanged lines hidden (view full) ---

42void qemu_aio_unref(void *p);
43void qemu_aio_ref(void *p);
44
45typedef struct AioHandler AioHandler;
46typedef void QEMUBHFunc(void *opaque);
47typedef bool AioPollFn(void *opaque);
48typedef void IOHandler(void *opaque);
49
50struct Coroutine;
50struct ThreadPool;
51struct LinuxAioState;
52
53struct AioContext {
54 GSource source;
55
56 /* Used by AioContext users to protect from multi-threaded access. */
57 QemuRecMutex lock;

--- 45 unchanged lines hidden (view full) ---

103 *
104 * Note that event_notifier_set *cannot* be optimized the same way. For
105 * more information on the problem that would result, see "#ifdef BUG2"
106 * in the docs/aio_notify_accept.promela formal model.
107 */
108 bool notified;
109 EventNotifier notifier;
110
51struct ThreadPool;
52struct LinuxAioState;
53
54struct AioContext {
55 GSource source;
56
57 /* Used by AioContext users to protect from multi-threaded access. */
58 QemuRecMutex lock;

--- 45 unchanged lines hidden (view full) ---

104 *
105 * Note that event_notifier_set *cannot* be optimized the same way. For
106 * more information on the problem that would result, see "#ifdef BUG2"
107 * in the docs/aio_notify_accept.promela formal model.
108 */
109 bool notified;
110 EventNotifier notifier;
111
112 QSLIST_HEAD(, Coroutine) scheduled_coroutines;
113 QEMUBH *co_schedule_bh;
114
111 /* Thread pool for performing work and receiving completion callbacks.
112 * Has its own locking.
113 */
114 struct ThreadPool *thread_pool;
115
116#ifdef CONFIG_LINUX_AIO
117 /* State for native Linux AIO. Uses aio_context_acquire/release for
118 * locking.

--- 359 unchanged lines hidden (view full) ---

478 * moment. True means green light.
479 */
480static inline bool aio_node_check(AioContext *ctx, bool is_external)
481{
482 return !is_external || !atomic_read(&ctx->external_disable_cnt);
483}
484
485/**
115 /* Thread pool for performing work and receiving completion callbacks.
116 * Has its own locking.
117 */
118 struct ThreadPool *thread_pool;
119
120#ifdef CONFIG_LINUX_AIO
121 /* State for native Linux AIO. Uses aio_context_acquire/release for
122 * locking.

--- 359 unchanged lines hidden (view full) ---

482 * moment. True means green light.
483 */
484static inline bool aio_node_check(AioContext *ctx, bool is_external)
485{
486 return !is_external || !atomic_read(&ctx->external_disable_cnt);
487}
488
489/**
490 * aio_co_schedule:
491 * @ctx: the aio context
492 * @co: the coroutine
493 *
494 * Start a coroutine on a remote AioContext.
495 *
496 * The coroutine must not be entered by anyone else while aio_co_schedule()
497 * is active. In addition the coroutine must have yielded unless ctx
498 * is the context in which the coroutine is running (i.e. the value of
499 * qemu_get_current_aio_context() from the coroutine itself).
500 */
501void aio_co_schedule(AioContext *ctx, struct Coroutine *co);
502
503/**
504 * aio_co_wake:
505 * @co: the coroutine
506 *
507 * Restart a coroutine on the AioContext where it was running last, thus
508 * preventing coroutines from jumping from one context to another when they
509 * go to sleep.
510 *
511 * aio_co_wake may be executed either in coroutine or non-coroutine
512 * context. The coroutine must not be entered by anyone else while
513 * aio_co_wake() is active.
514 */
515void aio_co_wake(struct Coroutine *co);
516
517/**
486 * Return the AioContext whose event loop runs in the current thread.
487 *
488 * If called from an IOThread this will be the IOThread's AioContext. If
489 * called from another thread it will be the main loop AioContext.
490 */
491AioContext *qemu_get_current_aio_context(void);
492
493/**

--- 31 unchanged lines hidden ---
518 * Return the AioContext whose event loop runs in the current thread.
519 *
520 * If called from an IOThread this will be the IOThread's AioContext. If
521 * called from another thread it will be the main loop AioContext.
522 */
523AioContext *qemu_get_current_aio_context(void);
524
525/**

--- 31 unchanged lines hidden ---