Merge branch 'fix_iouring_eintr' of https://github.com/anarazel/fio
[fio.git] / engines / io_uring.c
index 53bd39c8d739c1f91da4db8ef8b1845a49b5ae0d..8c4bcc57f414582419bad9986a29143b2d686785 100644 (file)
@@ -94,7 +94,7 @@ static struct fio_option options[] = {
                .off1   = offsetof(struct ioring_options, hipri),
                .help   = "Use polled IO completions",
                .category = FIO_OPT_C_ENGINE,
-               .group  = FIO_OPT_G_LIBAIO,
+               .group  = FIO_OPT_G_IOURING,
        },
        {
                .name   = "fixedbufs",
@@ -103,7 +103,7 @@ static struct fio_option options[] = {
                .off1   = offsetof(struct ioring_options, fixedbufs),
                .help   = "Pre map IO buffers",
                .category = FIO_OPT_C_ENGINE,
-               .group  = FIO_OPT_G_LIBAIO,
+               .group  = FIO_OPT_G_IOURING,
        },
        {
                .name   = "registerfiles",
@@ -112,7 +112,7 @@ static struct fio_option options[] = {
                .off1   = offsetof(struct ioring_options, registerfiles),
                .help   = "Pre-open/register files",
                .category = FIO_OPT_C_ENGINE,
-               .group  = FIO_OPT_G_LIBAIO,
+               .group  = FIO_OPT_G_IOURING,
        },
        {
                .name   = "sqthread_poll",
@@ -121,7 +121,7 @@ static struct fio_option options[] = {
                .off1   = offsetof(struct ioring_options, sqpoll_thread),
                .help   = "Offload submission/completion to kernel thread",
                .category = FIO_OPT_C_ENGINE,
-               .group  = FIO_OPT_G_LIBAIO,
+               .group  = FIO_OPT_G_IOURING,
        },
        {
                .name   = "sqthread_poll_cpu",
@@ -130,7 +130,7 @@ static struct fio_option options[] = {
                .cb     = fio_ioring_sqpoll_cb,
                .help   = "What CPU to run SQ thread polling on",
                .category = FIO_OPT_C_ENGINE,
-               .group  = FIO_OPT_G_LIBAIO,
+               .group  = FIO_OPT_G_IOURING,
        },
        {
                .name   = NULL,
@@ -259,7 +259,7 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min,
                        r = io_uring_enter(ld, 0, actual_min,
                                                IORING_ENTER_GETEVENTS);
                        if (r < 0) {
-                               if (errno == EAGAIN)
+                               if (errno == EAGAIN || errno == EINTR)
                                        continue;
                                td_verror(td, errno, "io_uring_enter");
                                break;
@@ -370,7 +370,7 @@ static int fio_ioring_commit(struct thread_data *td)
                        io_u_mark_submit(td, ret);
                        continue;
                } else {
-                       if (errno == EAGAIN) {
+                       if (errno == EAGAIN || errno == EINTR) {
                                ret = fio_ioring_cqring_reap(td, 0, ld->queued);
                                if (ret)
                                        continue;
@@ -555,6 +555,7 @@ static int fio_ioring_post_init(struct thread_data *td)
                return 1;
        }
 
+       printf("files=%d\n", o->registerfiles);
        if (o->registerfiles) {
                err = fio_ioring_register_files(td);
                if (err) {
@@ -613,7 +614,7 @@ static int fio_ioring_open_file(struct thread_data *td, struct fio_file *f)
        struct ioring_data *ld = td->io_ops_data;
        struct ioring_options *o = td->eo;
 
-       if (!o->registerfiles)
+       if (!ld || !o->registerfiles)
                return generic_open_file(td, f);
 
        f->fd = ld->fds[f->engine_pos];
@@ -622,9 +623,10 @@ static int fio_ioring_open_file(struct thread_data *td, struct fio_file *f)
 
 static int fio_ioring_close_file(struct thread_data *td, struct fio_file *f)
 {
+       struct ioring_data *ld = td->io_ops_data;
        struct ioring_options *o = td->eo;
 
-       if (!o->registerfiles)
+       if (!ld || !o->registerfiles)
                return generic_close_file(td, f);
 
        f->fd = -1;