Skip to contentSkip to conversation

add tests for drain io with multishot requests

PATCH Superseded Hao Xu 1 participant 1 message Apr 7, 2021 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hao Xu

author
#0 lore raw

PATCH 1/1 add tests for drain io with multishot requests

add new tests to test drain io with multishot requests

---
 src/include/liburing/io_uring.h |  13 ++++
 test/Makefile                   |   2 +
 test/multicqes_drain.c          | 129 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)
 create mode 100644 test/multicqes_drain.c
src/include/liburing/io_uring.h +13 -0
index d3d166e57be8..0fb4ed864b3d 100644
@@ -74,6 +74,7 @@ enum {
 	IOSQE_IO_HARDLINK_BIT,
 	IOSQE_ASYNC_BIT,
 	IOSQE_BUFFER_SELECT_BIT,
+	IOSQE_MULTI_CQES_BIT,
 };
 
 /*
@@ -91,6 +92,8 @@ enum {
 #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
 /* select buffer from sqe->buf_group */
 #define IOSQE_BUFFER_SELECT	(1U << IOSQE_BUFFER_SELECT_BIT)
+/* may generate multiple cqes */
+#define IOSQE_MULTI_CQES	(1U << IOSQE_MULTI_CQES_BIT)
 
 /*
  * io_uring_setup() flags
@@ -165,6 +168,16 @@ enum {
 #define SPLICE_F_FD_IN_FIXED	(1U << 31) /* the last bit of __u32 */
 
 /*
+ * POLL_ADD flags. Note that since sqe->poll_events is the flag space, the
+ * command flags for POLL_ADD are stored in sqe->len.
+ *
+ * IORING_POLL_UPDATE           Update existing poll request, matching
+ *                              sqe->addr as the old user_data field.
+ */
+#define IORING_POLL_UPDATE_EVENTS       (1U << 1)
+#define IORING_POLL_UPDATE_USER_DATA    (1U << 2)
+
+/*
  * IO completion data structure (Completion Queue Entry)
  */
 struct io_uring_cqe {
test/Makefile +2 -0
index 210571c22b40..8d2067c33b96 100644
@@ -115,6 +115,7 @@ test_targets += \
 	unlink \
 	wakeup-hang \
 	sendmsg_fs_cve \
+	multicqes_drain
 	# EOL
 
 all_targets += $(test_targets)
@@ -253,6 +254,7 @@ test_srcs := \
 	unlink.c \
 	wakeup-hang.c \
 	sendmsg_fs_cve.c \
+	multicqes_drain.c
 	# EOL
 
 test_objs := $(patsubst %.c,%.ol,$(patsubst %.cc,%.ol,$(test_srcs)))
test/multicqes_drain.c new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
1.8.3.1