Commit bc63afaf authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging



# gpg: Signature made Wed 28 Sep 2016 19:15:22 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  linux-aio: fix re-entrant completion processing
  test-coroutine: test qemu_coroutine_entered()
  coroutine: add qemu_coroutine_entered() function
  libqos: fix qvring_init()
  iothread: check iothread->ctx before aio_context_unref to avoid assertion
  aio-posix: avoid unnecessary aio_epoll_enabled() calls
  block: mirror: fix wrong comment of mirror_start

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 4af27939 fe121b9d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -431,13 +431,15 @@ bool aio_poll(AioContext *ctx, bool blocking)
    assert(npfd == 0);

    /* fill pollfds */

    if (!aio_epoll_enabled(ctx)) {
        QLIST_FOREACH(node, &ctx->aio_handlers, node) {
            if (!node->deleted && node->pfd.events
            && !aio_epoll_enabled(ctx)
                && aio_node_check(ctx, node->is_external)) {
                add_pollfd(node);
            }
        }
    }

    timeout = blocking ? aio_compute_timeout(ctx) : 0;

+6 −3
Original line number Diff line number Diff line
@@ -94,9 +94,12 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)

    laiocb->ret = ret;
    if (laiocb->co) {
        /* Jump and continue completion for foreign requests, don't do
         * anything for current request, it will be completed shortly. */
        if (laiocb->co != qemu_coroutine_self()) {
        /* If the coroutine is already entered it must be in ioq_submit() and
         * will notice laio->ret has been filled in when it eventually runs
         * later.  Coroutines cannot be entered recursively so avoid doing
         * that!
         */
        if (!qemu_coroutine_entered(laiocb->co)) {
            qemu_coroutine_enter(laiocb->co);
        }
    } else {
+1 −1
Original line number Diff line number Diff line
@@ -722,7 +722,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
 * @errp: Error object.
 *
 * Start a mirroring operation on @bs.  Clusters that are allocated
 * in @bs will be written to @bs until the job is cancelled or
 * in @bs will be written to @target until the job is cancelled or
 * manually completed.  At the end of a successful mirroring job,
 * @bs will be switched to read from @target.
 */
+13 −0
Original line number Diff line number Diff line
@@ -92,6 +92,19 @@ Coroutine *coroutine_fn qemu_coroutine_self(void);
 */
bool qemu_in_coroutine(void);

/**
 * Return true if the coroutine is currently entered
 *
 * A coroutine is "entered" if it has not yielded from the current
 * qemu_coroutine_enter() call used to run it.  This does not mean that the
 * coroutine is currently executing code since it may have transferred control
 * to another coroutine using qemu_coroutine_enter().
 *
 * When several coroutines enter each other there may be no way to know which
 * ones have already been entered.  In such situations this function can be
 * used to avoid recursively entering coroutines.
 */
bool qemu_coroutine_entered(Coroutine *co);


/**
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ static void iothread_instance_finalize(Object *obj)
    iothread_stop(obj, NULL);
    qemu_cond_destroy(&iothread->init_done_cond);
    qemu_mutex_destroy(&iothread->init_done_lock);
    if (!iothread->ctx) {
        return;
    }
    aio_context_unref(iothread->ctx);
}

Loading