* [PATCH liburing] tests: add IOSQE_ASYNC cancel testing
@ 2021-08-23 11:16 Pavel Begunkov
2021-08-23 16:17 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-08-23 11:16 UTC (permalink / raw)
To: Jens Axboe, io-uring
We miss tests for IORING_OP_ASYNC_CANCEL requests issued with
IOSQE_ASYNC, so add it.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/io-cancel.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/test/io-cancel.c b/test/io-cancel.c
index a4cc361..63d2f7d 100644
--- a/test/io-cancel.c
+++ b/test/io-cancel.c
@@ -115,7 +115,7 @@ static int do_io(struct io_uring *ring, int fd, int do_write)
return 0;
}
-static int start_cancel(struct io_uring *ring, int do_partial)
+static int start_cancel(struct io_uring *ring, int do_partial, int async_cancel)
{
struct io_uring_sqe *sqe;
int i, ret, submitted = 0;
@@ -129,6 +129,8 @@ static int start_cancel(struct io_uring *ring, int do_partial)
goto err;
}
io_uring_prep_cancel(sqe, (void *) (unsigned long) i + 1, 0);
+ if (async_cancel)
+ sqe->flags |= IOSQE_ASYNC;
sqe->user_data = 0;
submitted++;
}
@@ -148,7 +150,8 @@ err:
* the submitted IO. This is done to verify that cancelling one piece of IO doesn't
* impact others.
*/
-static int test_io_cancel(const char *file, int do_write, int do_partial)
+static int test_io_cancel(const char *file, int do_write, int do_partial,
+ int async_cancel)
{
struct io_uring ring;
struct timeval start_tv;
@@ -179,7 +182,7 @@ static int test_io_cancel(const char *file, int do_write, int do_partial)
goto err;
/* sleep for 1/3 of the total time, to allow some to start/complete */
usleep(usecs / 3);
- if (start_cancel(&ring, do_partial))
+ if (start_cancel(&ring, do_partial, async_cancel))
goto err;
to_wait = BUFFERS;
if (do_partial)
@@ -512,13 +515,15 @@ int main(int argc, char *argv[])
vecs = t_create_buffers(BUFFERS, BS);
- for (i = 0; i < 4; i++) {
- int v1 = (i & 1) != 0;
- int v2 = (i & 2) != 0;
+ for (i = 0; i < 8; i++) {
+ int write = (i & 1) != 0;
+ int partial = (i & 2) != 0;
+ int async = (i & 4) != 0;
- ret = test_io_cancel(".basic-rw", v1, v2);
+ ret = test_io_cancel(".basic-rw", write, partial, async);
if (ret) {
- fprintf(stderr, "test_io_cancel %d %d failed\n", v1, v2);
+ fprintf(stderr, "test_io_cancel %d %d %d failed\n",
+ write, partial, async);
goto err;
}
}
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH liburing] tests: add IOSQE_ASYNC cancel testing
2021-08-23 11:16 [PATCH liburing] tests: add IOSQE_ASYNC cancel testing Pavel Begunkov
@ 2021-08-23 16:17 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-08-23 16:17 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 8/23/21 5:16 AM, Pavel Begunkov wrote:
> We miss tests for IORING_OP_ASYNC_CANCEL requests issued with
> IOSQE_ASYNC, so add it.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-23 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-23 11:16 [PATCH liburing] tests: add IOSQE_ASYNC cancel testing Pavel Begunkov
2021-08-23 16:17 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox