On Wed, Jul 07, 2021 at 05:00:19PM +0200, Stefano Garzarella wrote: > @@ -371,7 +375,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb > *laiocb, off_t offset, > s->io_q.in_queue++; > if (!s->io_q.blocked && > (!s->io_q.plugged || > - s->io_q.in_flight + s->io_q.in_queue >= MAX_EVENTS)) { > + s->io_q.in_queue >= max_batch)) {
Is it safe to drop the MAX_EVENTS case? Perhaps the following can be used: int64_t max_batch = s->aio_context->aio_max_batch ?: DEFAULT_MAX_BATCH; max_batch = MIN_NON_ZERO(MAX_EVENTS - s->io_q.in_flight + s->io_q.in_queue, max_batch); Here we'll only need to check against max_batch but it takes into account MAX_EVENT and in_flight. Stefan
signature.asc
Description: PGP signature