[PATCH 2 of 8] Added variables and defined a new flag for io_uring module

SoYun Seong thdbsdox12 at gmail.com
Tue Nov 24 08:43:30 UTC 2020


# HG changeset patch
# User SoYun Seong <thdbsdox12 at gmail.com>
# Date 1606128433 0
#      Mon Nov 23 10:47:13 2020 +0000
# Node ID 3bbe4905410b04bdaad4c956f6fdb7d0612ddf5b
# Parent  1cb2b354e262e10a8e8606e238ca0fa279f70709
Added variables and defined a new flag for io_uring module.

For io_uring event module, added member variables to ngx_event_s structure. ‘uring_res’ is used to pass the result of IO to a read or write event. ‘uring_pending’ means the total requested IO count of the event and ‘uring_rq_size’ means the total IO size of the event. Both variables is used to check completion of the request. ‘uring_iov’ is used to do asynchronous vector IO. ‘uring_splice_pipe’ is used to process asynchronous sendfile. Also added an io_uring event flag and defined requested IO type for io_uring.

diff -r 1cb2b354e262 -r 3bbe4905410b src/event/ngx_event.h
--- a/src/event/ngx_event.h	Mon Nov 23 10:08:50 2020 +0000
+++ b/src/event/ngx_event.h	Mon Nov 23 10:47:13 2020 +0000
@@ -107,6 +107,14 @@
     ngx_event_ovlp_t ovlp;
 #endif
 
+#if (NGX_HAVE_URING)
+    int                 uring_res;
+    ngx_uint_t          uring_pending;
+    ssize_t             uring_rq_size;
+    struct iovec        uring_iov[NGX_IOVS_PREALLOCATE];
+    int                 uring_splice_pipe[2];
+#endif
+
     ngx_uint_t       index;
 
     ngx_log_t       *log;
@@ -271,6 +279,11 @@
  */
 #define NGX_USE_VNODE_EVENT      0x00002000
 
+/*
+ * The event filter is io_uring.
+ */
+#define NGX_USE_URING_EVENT      0x00004000
+
 
 /*
  * The event filter is deleted just before the closing file.
@@ -390,6 +403,19 @@
 #define NGX_IOCP_CONNECT     2
 #endif
 
+#if (NGX_HAVE_URING)
+#define NGX_URING_ACCEPT            0
+#define NGX_URING_READ              1
+#define NGX_URING_READV             2
+#define NGX_URING_SEND              3
+#define NGX_URING_WRITEV            4
+#define NGX_URING_SPLICE_TO_PIPE    5
+#define NGX_URING_SPLICE_FROM_PIPE  6
+#define NGX_URING_READFILE          7
+#define NGX_URING_TIMEOUT           1
+#define NGX_USE_URING_SPLICE        0
+#endif
+
 
 #if (NGX_TEST_BUILD_EPOLL)
 #define NGX_EXCLUSIVE_EVENT  0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-2.patch
Type: text/x-patch
Size: 2148 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20201124/202a76fe/attachment.bin>


More information about the nginx-devel mailing list