+static int fio_libaio_old_queue_init(struct libaio_data *ld, unsigned int depth,
+ bool hipri)
+{
+ if (hipri) {
+ log_err("fio: polled aio not available on your platform\n");
+ return 1;
+ }
+
+ return io_queue_init(depth, &ld->aio_ctx);
+}
+
+static int fio_libaio_queue_init(struct libaio_data *ld, unsigned int depth,
+ bool hipri)
+{
+#ifdef __NR_sys_io_setup2
+ int ret, flags = 0;
+
+ if (hipri)
+ flags |= IOCTX_FLAG_IOPOLL;
+
+ ret = syscall(__NR_sys_io_setup2, depth, flags, NULL, NULL,
+ &ld->aio_ctx);
+ if (!ret)
+ return 0;
+ /* fall through to old syscall */
+#endif
+ return fio_libaio_old_queue_init(ld, depth, hipri);
+}
+
+static int fio_libaio_post_init(struct thread_data *td)