From: Jens Axboe Date: Tue, 4 Sep 2012 17:47:00 +0000 (-0600) Subject: libaio: pass in 0 for queue depth if we can X-Git-Tag: fio-2.0.10~42 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c90e1017b9384b170d47b97d2353f7bff3b5a34d libaio: pass in 0 for queue depth if we can We don't need the user ring, unless the job file specified that we need it. So tell the kernel. Fall back to passing in the normal queue depth, if the kernel doesn't support disabling the user ring. Signed-off-by: Jens Axboe --- diff --git a/engines/libaio.c b/engines/libaio.c index e4869aa9..ad7903cf 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -255,11 +255,20 @@ static void fio_libaio_cleanup(struct thread_data *td) static int fio_libaio_init(struct thread_data *td) { struct libaio_data *ld = malloc(sizeof(*ld)); - int err; + struct libaio_options *o = td->eo; + int err = 0; memset(ld, 0, sizeof(*ld)); - err = io_queue_init(td->o.iodepth, &ld->aio_ctx); + /* + * First try passing in 0 for queue depth, since we don't + * care about the user ring. If that fails, the kernel is too old + * and we need the right depth. + */ + if (!o->userspace_reap) + err = io_queue_init(0, &ld->aio_ctx); + if (o->userspace_reap || err == -EINVAL) + err = io_queue_init(td->o.iodepth, &ld->aio_ctx); if (err) { td_verror(td, -err, "io_queue_init"); log_err("fio: check /proc/sys/fs/aio-max-nr\n");