summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-03-29 16:38:27 -0600
committerJens Axboe <axboe@kernel.dk>2022-03-29 16:38:27 -0600
commit000dd873f4da9b6052792c93d4d0978bb4ea3252 (patch)
treeaf79c1374cfe69398bfc98b814f274d1528371b7
parentcd63b85f857d87a3e4699b6ee5cc43b5dfb8682e (diff)
downloadliburing-000dd873f4da9b6052792c93d4d0978bb4ea3252.tar.gz
liburing-000dd873f4da9b6052792c93d4d0978bb4ea3252.tar.bz2
test/open-direct-link: add IOSQE_ASYNC
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/open-direct-link.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/test/open-direct-link.c b/test/open-direct-link.c
index 98a9cc0..33f88f4 100644
--- a/test/open-direct-link.c
+++ b/test/open-direct-link.c
@@ -16,7 +16,7 @@
#define MAX_FILES 8
#define FNAME ".link.direct"
-static int test(struct io_uring *ring, int skip_success, int drain)
+static int test(struct io_uring *ring, int skip_success, int drain, int async)
{
struct io_uring_cqe *cqe;
struct io_uring_sqe *sqe;
@@ -33,6 +33,8 @@ static int test(struct io_uring *ring, int skip_success, int drain)
sqe->flags |= IOSQE_IO_LINK;
if (skip_success)
sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
+ if (async)
+ sqe->flags |= IOSQE_ASYNC;
sqe->user_data = 1;
sqe = io_uring_get_sqe(ring);
@@ -42,6 +44,8 @@ static int test(struct io_uring *ring, int skip_success, int drain)
sqe->flags |= IOSQE_IO_DRAIN;
else
sqe->flags |= IOSQE_IO_LINK;
+ if (async)
+ sqe->flags |= IOSQE_ASYNC;
sqe->user_data = 2;
sqe = io_uring_get_sqe(ring);
@@ -51,6 +55,8 @@ static int test(struct io_uring *ring, int skip_success, int drain)
sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
if (drain)
sqe->flags |= IOSQE_IO_DRAIN;
+ if (async)
+ sqe->flags |= IOSQE_ASYNC;
ret = io_uring_submit(ring);
if (ret != 3) {
@@ -138,21 +144,39 @@ int main(int argc, char *argv[])
t_create_file(FNAME, 4096);
- ret = test(&ring, 0, 0);
+ ret = test(&ring, 0, 0, 0);
if (ret) {
- fprintf(stderr, "test 0 0 failed\n");
+ fprintf(stderr, "test 0 0 0 failed\n");
goto err;
}
- ret = test(&ring, 0, 1);
+ ret = test(&ring, 0, 1, 0);
if (ret) {
- fprintf(stderr, "test 0 1 failed\n");
+ fprintf(stderr, "test 0 1 0 failed\n");
goto err;
}
- ret = test(&ring, 1, 0);
+ ret = test(&ring, 0, 0, 1);
if (ret) {
- fprintf(stderr, "test 1 0 failed\n");
+ fprintf(stderr, "test 0 0 1 failed\n");
+ goto err;
+ }
+
+ ret = test(&ring, 0, 1, 1);
+ if (ret) {
+ fprintf(stderr, "test 0 1 1 failed\n");
+ goto err;
+ }
+
+ ret = test(&ring, 1, 0, 0);
+ if (ret) {
+ fprintf(stderr, "test 1 0 0 failed\n");
+ goto err;
+ }
+
+ ret = test(&ring, 1, 0, 1);
+ if (ret) {
+ fprintf(stderr, "test 1 0 1 failed\n");
goto err;
}