os/windows/posix.c: Strip trailing whitespace
[fio.git] / t / io_uring.c
index 79a92311b0dc7cb913b605192b5bb6fe5acf2ec7..d48db1e95d5ab5a94a7d529c293e95a2f37dd02d 100644 (file)
@@ -63,7 +63,6 @@ struct file {
 struct submitter {
        pthread_t thread;
        int ring_fd;
-       struct drand48_data rand;
        struct io_sq_ring sq_ring;
        struct io_uring_sqe *sqes;
        struct io_cq_ring cq_ring;
@@ -100,7 +99,7 @@ static int io_uring_register_buffers(struct submitter *s)
        if (do_nop)
                return 0;
 
-       return syscall(__NR_sys_io_uring_register, s->ring_fd,
+       return syscall(__NR_io_uring_register, s->ring_fd,
                        IORING_REGISTER_BUFFERS, s->iovecs, depth);
 }
 
@@ -117,26 +116,28 @@ static int io_uring_register_files(struct submitter *s)
                s->files[i].fixed_fd = i;
        }
 
-       return syscall(__NR_sys_io_uring_register, s->ring_fd,
+       return syscall(__NR_io_uring_register, s->ring_fd,
                        IORING_REGISTER_FILES, s->fds, s->nr_files);
 }
 
 static int io_uring_setup(unsigned entries, struct io_uring_params *p)
 {
-       return syscall(__NR_sys_io_uring_setup, entries, p);
+       return syscall(__NR_io_uring_setup, entries, p);
 }
 
 static int io_uring_enter(struct submitter *s, unsigned int to_submit,
                          unsigned int min_complete, unsigned int flags)
 {
-       return syscall(__NR_sys_io_uring_enter, s->ring_fd, to_submit,
-                       min_complete, flags, NULL, 0);
+       return syscall(__NR_io_uring_enter, s->ring_fd, to_submit, min_complete,
+                       flags, NULL, 0);
 }
 
+#ifndef CONFIG_HAVE_GETTID
 static int gettid(void)
 {
        return syscall(__NR_gettid);
 }
+#endif
 
 static unsigned file_depth(struct submitter *s)
 {
@@ -168,7 +169,7 @@ static void init_io(struct submitter *s, unsigned index)
        }
        f->pending_ios++;
 
-       lrand48_r(&s->rand, &r);
+       r = lrand48();
        offset = (r % (f->max_blocks - 1)) * BS;
 
        if (register_files) {
@@ -214,8 +215,6 @@ static int prep_more_ios(struct submitter *s, int max_ios)
        } while (prepped < max_ios);
 
        if (*ring->tail != tail) {
-               /* order tail store with writes to sqes above */
-               write_barrier();
                *ring->tail = tail;
                write_barrier();
        }
@@ -264,7 +263,7 @@ static int reap_events(struct submitter *s)
                        if (cqe->res != BS) {
                                printf("io: unexpected ret=%d\n", cqe->res);
                                if (polled && cqe->res == -EOPNOTSUPP)
-                                       printf("Your filesystem doesn't support poll\n");
+                                       printf("Your filesystem/driver/kernel doesn't support polled IO\n");
                                return -1;
                        }
                }
@@ -286,7 +285,7 @@ static void *submitter_fn(void *data)
 
        printf("submitter=%d\n", gettid());
 
-       srand48_r(pthread_self(), &s->rand);
+       srand48(pthread_self());
 
        prepped = 0;
        do {