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