On Wed, Jul 13, 2016 at 9:43 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 12/07/2016 19:51, Roman Pen wrote: >> + if (s->io_q.in_flight >= MAX_EVENTS) >> + break; >> QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { >> iocbs[len++] = &aiocb->iocb; >> - if (len == MAX_QUEUED_IO) { >> + if (s->io_q.in_flight + len >= MAX_EVENTS) { >> break; >> } > > More easily written like this: > > QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { > if (s->io_q.in_flight + len >= MAX_EVENTS) { > break; > } > iocbs[len++] = &aiocb->iocb; > } > > so that the early "if" is not necessary. Also because you forgot the > braces around it. :)
No, we will jump out of the QSIMPLEQ_FOREACH loop and will then invoke io_submit() with len == 0. -- Roman