X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Flibaio.c;h=748233c268e1dad4a106c00c4c1497ad62010c0f;hb=f681d0bac9c42e5d6bcb3601d2f3cfaa1c2cefb4;hp=2b8c6dac533c8bf2c9f1cdd0cc02e7ba7a599b72;hpb=80666bece308842c36132245e4cbbe9eb0bc506b;p=fio.git diff --git a/engines/libaio.c b/engines/libaio.c index 2b8c6dac..748233c2 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -257,11 +257,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(INT_MAX, &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");