[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: |
Ming Lei |
Subject: |
Re: [Qemu-devel] [PATCH v3 2/3] linux-aio: handling -EAGAIN for !s->io_q.plugged case |
Date: |
Sat, 22 Nov 2014 20:24:43 +0800 |
On Tue, Nov 18, 2014 at 10:06 PM, Paolo Bonzini <address@hidden> wrote:
>
>
> 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?
It is for avoiding unnecessary submission which will cause
another -EAGAIN.
>
>> + /*
>> + * 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;
> }
> }
Right.
Thanks,
Ming Lei
[Qemu-devel] [PATCH v3 2/3] linux-aio: handling -EAGAIN for !s->io_q.plugged case, Ming Lei, 2014/11/06
[Qemu-devel] [PATCH v3 3/3] linux-aio: remove 'node' from 'struct qemu_laiocb', Ming Lei, 2014/11/06