summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/io_uring.h2
-rw-r--r--test/fsync.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/io_uring.h b/src/io_uring.h
index 57b8f4d..43ecbc1 100644
--- a/src/io_uring.h
+++ b/src/io_uring.h
@@ -38,6 +38,7 @@ struct io_uring_sqe {
* sqe->flags
*/
#define IOSQE_FIXED_FILE (1U << 0) /* use fixed fileset */
+#define IOSQE_IO_DRAIN (1U << 1)
/*
* io_uring_setup() flags
@@ -59,7 +60,6 @@ struct io_uring_sqe {
* sqe->fsync_flags
*/
#define IORING_FSYNC_DATASYNC (1U << 0)
-#define IORING_FSYNC_BARRIER (1U << 1)
/*
* IO completion data structure (Completion Queue Entry)
diff --git a/test/fsync.c b/test/fsync.c
index 771e0d5..b854a44 100644
--- a/test/fsync.c
+++ b/test/fsync.c
@@ -35,7 +35,7 @@ static int test_single_fsync(struct io_uring *ring)
ret = io_uring_submit(ring);
if (ret <= 0) {
- printf("sqe submit failed\n");
+ printf("sqe submit failed: %d\n", ret);
goto err;
}
@@ -90,9 +90,9 @@ static int test_barrier_fsync(struct io_uring *ring)
goto err;
}
- io_uring_prep_fsync(sqe, fd,
- IORING_FSYNC_DATASYNC | IORING_FSYNC_BARRIER);
+ io_uring_prep_fsync(sqe, fd, IORING_FSYNC_DATASYNC);
sqe->user_data = 1;
+ sqe->flags = IOSQE_IO_DRAIN;
ret = io_uring_submit(ring);
if (ret <= 0) {
@@ -141,12 +141,16 @@ int main(int argc, char *argv[])
}
ret = test_single_fsync(&ring);
- if (ret)
+ if (ret) {
+ printf("test_single_fsync failed\n");
return ret;
+ }
ret = test_barrier_fsync(&ring);
- if (ret)
+ if (ret) {
+ printf("test_single_fsync failed\n");
return ret;
+ }
return 0;
}