qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/3] linux-aio: handling -EAGAIN for !s->io_q


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 2/3] linux-aio: handling -EAGAIN for !s->io_q.plugged case
Date: Tue, 18 Nov 2014 15:06:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0


On 06/11/2014 16:10, Ming Lei wrote:
> +    /* don't submit until next completion for -EAGAIN of non plug case */
> +    if (unlikely(!s->io_q.plugged)) {
> +        return 0;
> +    }
> +

Is this an optimization or a fix for something?

> +        /*
> +         * Switch to queue mode until -EAGAIN is handled, we suppose
> +         * there is always uncompleted I/O, so try to enqueue it first,
> +         * and will be submitted again in following aio completion cb.
> +         */
> +        if (ret == -EAGAIN) {
> +            goto enqueue;
> +        } else if (ret < 0) {
>              goto out_free_aiocb;
>          }

Better:

     if (!s->io_q.plugged && !s->io_q.idx) {
        ret = io_submit(s->ctx, 1, &iocbs);
        if (ret >= 0) {
            return &laiocb->common;
        }
        if (ret != -EAGAIN) {
            goto out_free_aiocb;
        }
    }

    /* code for queue mode.  */

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]