Lines Matching refs:bh
73 static void aio_bh_enqueue(QEMUBH *bh, unsigned new_flags) in aio_bh_enqueue() argument
75 AioContext *ctx = bh->ctx; in aio_bh_enqueue()
82 old_flags = qatomic_fetch_or(&bh->flags, BH_PENDING | new_flags); in aio_bh_enqueue()
94 QSLIST_INSERT_HEAD_ATOMIC(&ctx->bh_list, bh, next); in aio_bh_enqueue()
112 QEMUBH *bh = QSLIST_FIRST_RCU(head); in aio_bh_dequeue() local
114 if (!bh) { in aio_bh_dequeue()
124 *flags = qatomic_fetch_and(&bh->flags, in aio_bh_dequeue()
126 return bh; in aio_bh_dequeue()
132 QEMUBH *bh; in aio_bh_schedule_oneshot_full() local
133 bh = g_new(QEMUBH, 1); in aio_bh_schedule_oneshot_full()
134 *bh = (QEMUBH){ in aio_bh_schedule_oneshot_full()
140 aio_bh_enqueue(bh, BH_SCHEDULED | BH_ONESHOT); in aio_bh_schedule_oneshot_full()
146 QEMUBH *bh; in aio_bh_new_full() local
147 bh = g_new(QEMUBH, 1); in aio_bh_new_full()
148 *bh = (QEMUBH){ in aio_bh_new_full()
155 return bh; in aio_bh_new_full()
158 void aio_bh_call(QEMUBH *bh) in aio_bh_call() argument
163 MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard; in aio_bh_call()
167 trace_reentrant_aio(bh->ctx, bh->name); in aio_bh_call()
172 bh->cb(bh->opaque); in aio_bh_call()
205 QEMUBH *bh; in aio_bh_poll() local
208 bh = aio_bh_dequeue(&s->bh_list, &flags); in aio_bh_poll()
209 if (!bh) { in aio_bh_poll()
219 aio_bh_call(bh); in aio_bh_poll()
222 g_free(bh); in aio_bh_poll()
229 void qemu_bh_schedule_idle(QEMUBH *bh) in qemu_bh_schedule_idle() argument
231 aio_bh_enqueue(bh, BH_SCHEDULED | BH_IDLE); in qemu_bh_schedule_idle()
234 void qemu_bh_schedule(QEMUBH *bh) in qemu_bh_schedule() argument
236 aio_bh_enqueue(bh, BH_SCHEDULED); in qemu_bh_schedule()
241 void qemu_bh_cancel(QEMUBH *bh) in qemu_bh_cancel() argument
243 qatomic_and(&bh->flags, ~BH_SCHEDULED); in qemu_bh_cancel()
249 void qemu_bh_delete(QEMUBH *bh) in qemu_bh_delete() argument
251 aio_bh_enqueue(bh, BH_DELETED); in qemu_bh_delete()
256 QEMUBH *bh; in aio_compute_bh_timeout() local
258 QSLIST_FOREACH_RCU(bh, head, next) { in aio_compute_bh_timeout()
259 if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) { in aio_compute_bh_timeout()
260 if (bh->flags & BH_IDLE) { in aio_compute_bh_timeout()
330 QEMUBH *bh; in aio_ctx_check() local
337 QSLIST_FOREACH_RCU(bh, &ctx->bh_list, next) { in aio_ctx_check()
338 if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) { in aio_ctx_check()
344 QSLIST_FOREACH_RCU(bh, &s->bh_list, next) { in aio_ctx_check()
345 if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) { in aio_ctx_check()
369 QEMUBH *bh; in aio_ctx_finalize() local
396 while ((bh = aio_bh_dequeue(&ctx->bh_list, &flags))) { in aio_ctx_finalize()
408 __func__, bh->name); in aio_ctx_finalize()
412 g_free(bh); in aio_ctx_finalize()