diff options
Diffstat (limited to 'test/submit-reuse.c')
-rw-r--r-- | test/submit-reuse.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/test/submit-reuse.c b/test/submit-reuse.c index 74ba769..d5ccdd4 100644 --- a/test/submit-reuse.c +++ b/test/submit-reuse.c @@ -26,13 +26,11 @@ struct thread_data { static void *flusher(void *__data) { struct thread_data *data = __data; - int i = 0; while (!data->do_exit) { posix_fadvise(data->fd1, 0, FILE_SIZE, POSIX_FADV_DONTNEED); posix_fadvise(data->fd2, 0, FILE_SIZE, POSIX_FADV_DONTNEED); usleep(10); - i++; } return NULL; @@ -140,11 +138,6 @@ static int test_reuse(int argc, char *argv[], int split, int async) int do_unlink = 1; void *tret; - if (argc > 1) { - fname1 = argv[1]; - do_unlink = 0; - } - ret = io_uring_queue_init_params(32, &ring, &p); if (ret) { fprintf(stderr, "io_uring_queue_init: %d\n", ret); @@ -153,21 +146,29 @@ static int test_reuse(int argc, char *argv[], int split, int async) if (!(p.features & IORING_FEAT_SUBMIT_STABLE)) { fprintf(stdout, "FEAT_SUBMIT_STABLE not there, skipping\n"); + io_uring_queue_exit(&ring); no_stable = 1; return 0; } - if (do_unlink) + if (argc > 1) { + fname1 = argv[1]; + do_unlink = 0; + } else { t_create_file(fname1, FILE_SIZE); - - t_create_file(".reuse.2", FILE_SIZE); + } fd1 = open(fname1, O_RDONLY); + if (do_unlink) + unlink(fname1); if (fd1 < 0) { perror("open fname1"); goto err; } + + t_create_file(".reuse.2", FILE_SIZE); fd2 = open(".reuse.2", O_RDONLY); + unlink(".reuse.2"); if (fd2 < 0) { perror("open .reuse.2"); goto err; @@ -206,15 +207,9 @@ static int test_reuse(int argc, char *argv[], int split, int async) close(fd2); close(fd1); io_uring_queue_exit(&ring); - if (do_unlink) - unlink(fname1); - unlink(".reuse.2"); return 0; err: io_uring_queue_exit(&ring); - if (do_unlink) - unlink(fname1); - unlink(".reuse.2"); return 1; } |