Skip to content

Commit 49716c9

Browse files
committed
revert iouring
1 parent 9ce89a8 commit 49716c9

13 files changed

+0
-823
lines changed

config.m4

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ PHP_ARG_ENABLE([cares],
5656
[AS_HELP_STRING([--enable-cares],
5757
[Enable cares])], [no], [no])
5858

59-
PHP_ARG_ENABLE([iouring],
60-
[enable io-uring support],
61-
[AS_HELP_STRING([--enable-iouring],
62-
[Enable io-uring (Experimental)])], [no], [no])
63-
6459
PHP_ARG_WITH([openssl_dir],
6560
[dir of openssl],
6661
[AS_HELP_STRING([[--with-openssl-dir[=DIR]]],
@@ -903,13 +898,6 @@ EOF
903898
PHP_ADD_LIBRARY(cares, 1, SWOOLE_SHARED_LIBADD)
904899
fi
905900

906-
if test "$PHP_IOURING" = "yes"; then
907-
AC_CHECK_LIB(uring, io_uring_queue_init, [
908-
AC_DEFINE(SW_USE_IOURING, 1, [have io_uring])
909-
PHP_ADD_LIBRARY(uring, 1, SWOOLE_SHARED_LIBADD)
910-
])
911-
fi
912-
913901
AC_SWOOLE_CPU_AFFINITY
914902
AC_SWOOLE_HAVE_REUSEPORT
915903
AC_SWOOLE_HAVE_FUTEX

ext-src/php_swoole.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,6 @@ PHP_MINFO_FUNCTION(swoole) {
906906
#endif
907907
#ifdef SW_USE_SQLITE
908908
php_info_print_table_row(2, "coroutine_sqlite", "enabled");
909-
#endif
910-
#ifdef SW_USE_IOURING
911-
php_info_print_table_row(2, "io_uring", "enabled");
912909
#endif
913910
php_info_print_table_end();
914911

ext-src/php_swoole_private.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ extern PHPAPI int php_array_merge(zend_array *dest, zend_array *src);
108108
#error "thread context cannot be used with ZTS"
109109
#endif
110110

111-
#if defined(SW_USE_IOURING) && !defined(__linux__)
112-
#error "only linux support iouring"
113-
#endif
114-
115111
//--------------------------------------------------------
116112
#define SW_MAX_FIND_COUNT 100 // for swoole_server::connection_list
117113
#define SW_PHP_CLIENT_BUFFER_SIZE 65535

ext-src/swoole_async_coro.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ void php_swoole_set_aio_option(HashTable *vht) {
6060
if (php_swoole_array_get_value(vht, "aio_max_idle_time", ztmp)) {
6161
SwooleG.aio_max_idle_time = zval_get_double(ztmp);
6262
}
63-
#if defined(__linux__) && defined(SW_USE_IOURING)
64-
if (php_swoole_array_get_value(vht, "iouring_entries", ztmp)) {
65-
zend_long v = zval_get_long(ztmp);
66-
SwooleG.iouring_entries = SW_MAX(0, SW_MIN(v, UINT32_MAX));
67-
}
68-
#endif
6963
}
7064

7165
PHP_FUNCTION(swoole_async_set) {

include/swoole.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@
6161
#include <list>
6262
#include <functional>
6363

64-
#ifdef SW_USE_IOURING
65-
#include <liburing.h>
66-
#endif
67-
6864
typedef unsigned long ulong_t;
6965

7066
#ifndef PRId64
@@ -204,9 +200,6 @@ struct Socket;
204200
struct Address;
205201
} // namespace network
206202
class AsyncThreads;
207-
#ifdef SW_USE_IOURING
208-
class AsyncIouring;
209-
#endif
210203
namespace async {
211204
class ThreadPool;
212205
}
@@ -667,9 +660,6 @@ struct ThreadGlobal {
667660
Reactor *reactor;
668661
Timer *timer;
669662
AsyncThreads *async_threads;
670-
#ifdef SW_USE_IOURING
671-
AsyncIouring *async_iouring;
672-
#endif
673663
uint32_t signal_listener_num;
674664
uint32_t co_signal_listener_num;
675665
int error;
@@ -750,9 +740,6 @@ struct Global {
750740
//-----------------------[AIO]--------------------------
751741
uint32_t aio_core_worker_num;
752742
uint32_t aio_worker_num;
753-
#ifdef SW_USE_IOURING
754-
uint32_t iouring_entries;
755-
#endif
756743
double aio_max_wait_time;
757744
double aio_max_idle_time;
758745
network::Socket *aio_default_socket;

include/swoole_async.h

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
#include <atomic>
2525
#include <queue>
2626

27-
#ifdef SW_USE_IOURING
28-
#include "linux/version.h"
29-
#include <liburing.h>
30-
#endif
31-
3227
#ifndef O_DIRECT
3328
#define O_DIRECT 040000
3429
#endif
@@ -42,32 +37,16 @@ enum AsyncFlag {
4237

4338
struct AsyncEvent {
4439
size_t task_id;
45-
#ifdef SW_USE_IOURING
46-
size_t count;
47-
#endif
4840
uint8_t canceled;
4941
int error;
5042
/**
5143
* input & output
5244
*/
5345
void *data;
54-
#ifdef SW_USE_IOURING
55-
const char *pathname;
56-
const char *pathname2;
57-
struct statx *statxbuf;
58-
void *rbuf;
59-
const void *wbuf;
60-
#endif
6146
/**
6247
* output
6348
*/
6449
ssize_t retval;
65-
#ifdef SW_USE_IOURING
66-
int fd;
67-
int flags;
68-
int opcode;
69-
mode_t mode;
70-
#endif
7150
/**
7251
* internal use only
7352
*/
@@ -124,91 +103,6 @@ class AsyncThreads {
124103
std::mutex init_lock;
125104
};
126105

127-
#ifdef SW_USE_IOURING
128-
class AsyncIouring {
129-
private:
130-
int ring_fd;
131-
uint64_t task_num = 0;
132-
uint64_t entries = 8192;
133-
struct io_uring ring;
134-
std::queue<AsyncEvent *> waitEvents;
135-
network::Socket *iou_socket = nullptr;
136-
Reactor *reactor = nullptr;
137-
138-
inline struct io_uring_sqe *get_iouring_sqe() {
139-
struct io_uring_sqe *sqe = io_uring_get_sqe(&ring);
140-
// We need to reset the values of each sqe structure so that they can be used in a loop.
141-
if (sqe) {
142-
memset(sqe, 0, sizeof(struct io_uring_sqe));
143-
}
144-
return sqe;
145-
}
146-
147-
inline void set_iouring_sqe_data(struct io_uring_sqe *sqe, void *data) {
148-
io_uring_sqe_set_data(sqe, data);
149-
}
150-
151-
inline void *get_iouring_cqe_data(struct io_uring_cqe *cqe) {
152-
return io_uring_cqe_get_data(cqe);
153-
}
154-
155-
inline int get_iouring_cqes(struct io_uring_cqe **cqe_ptr, unsigned count) {
156-
return io_uring_peek_batch_cqe(&ring, cqe_ptr, count);
157-
}
158-
159-
inline void finish_iouring_cqes(unsigned count) {
160-
io_uring_cq_advance(&ring, count);
161-
}
162-
163-
inline bool submit_iouring_sqe() {
164-
return io_uring_submit(&ring);
165-
}
166-
167-
public:
168-
AsyncIouring(Reactor *reactor_);
169-
~AsyncIouring();
170-
171-
enum opcodes {
172-
SW_IORING_OP_OPENAT = IORING_OP_OPENAT,
173-
SW_IORING_OP_CLOSE = IORING_OP_CLOSE,
174-
SW_IORING_OP_STATX = IORING_OP_STATX,
175-
SW_IORING_OP_READ = IORING_OP_READ,
176-
SW_IORING_OP_WRITE = IORING_OP_WRITE,
177-
SW_IORING_OP_RENAMEAT = IORING_OP_RENAMEAT,
178-
SW_IORING_OP_UNLINKAT = IORING_OP_UNLINKAT,
179-
SW_IORING_OP_MKDIRAT = IORING_OP_MKDIRAT,
180-
181-
SW_IORING_OP_FSTAT = 1000,
182-
SW_IORING_OP_LSTAT = 1001,
183-
SW_IORING_OP_UNLINK_FILE = 1002,
184-
SW_IORING_OP_UNLINK_DIR = 1003,
185-
SW_IORING_OP_FSYNC = 1004,
186-
SW_IORING_OP_FDATASYNC = 1005,
187-
};
188-
189-
void add_event();
190-
void delete_event();
191-
bool wakeup();
192-
bool open(AsyncEvent *event);
193-
bool close(AsyncEvent *event);
194-
bool wr(AsyncEvent *event);
195-
bool statx(AsyncEvent *event);
196-
bool mkdir(AsyncEvent *event);
197-
bool unlink(AsyncEvent *event);
198-
bool rename(AsyncEvent *event);
199-
bool fsync(AsyncEvent *event);
200-
inline bool is_empty_wait_events() {
201-
return waitEvents.size() == 0;
202-
}
203-
204-
inline uint64_t get_task_num() {
205-
return task_num;
206-
}
207-
208-
static int callback(Reactor *reactor, Event *event);
209-
};
210-
#endif
211-
212106
namespace async {
213107

214108
typedef void (*Handler)(AsyncEvent *event);

include/swoole_coroutine.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -304,22 +304,6 @@ class Coroutine {
304304
namespace coroutine {
305305
bool async(async::Handler handler, AsyncEvent &event, double timeout = -1);
306306
bool async(const std::function<void(void)> &fn, double timeout = -1);
307-
#ifdef SW_USE_IOURING
308-
int async(AsyncIouring::opcodes opcode,
309-
const char *pathname,
310-
const char *pathname2 = nullptr,
311-
mode_t mode = 0,
312-
int flags = 0,
313-
struct statx *statxbuf = nullptr,
314-
double timeout = -1);
315-
int async(AsyncIouring::opcodes opcode,
316-
int fd,
317-
void *rbuf = nullptr,
318-
const void *wbuf = nullptr,
319-
struct statx *statxbuf = nullptr,
320-
size_t count = 0,
321-
double timeout = -1);
322-
#endif
323307
bool run(const CoroutineFunc &fn, void *arg = nullptr);
324308
} // namespace coroutine
325309
//-------------------------------------------------------------------------------

include/swoole_coroutine_c_api.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,6 @@ int swoole_coroutine_statvfs(const char *path, struct statvfs *buf);
6565
int swoole_coroutine_close_file(int fd);
6666
int swoole_coroutine_fsync(int fd);
6767
int swoole_coroutine_fdatasync(int fd);
68-
/**
69-
* io_uring
70-
*/
71-
#ifdef SW_USE_IOURING
72-
int swoole_coroutine_iouring_open(const char *pathname, int flags, mode_t mode);
73-
int swoole_coroutine_iouring_close_file(int fd);
74-
ssize_t swoole_coroutine_iouring_read(int sockfd, void *buf, size_t count);
75-
ssize_t swoole_coroutine_iouring_write(int sockfd, const void *buf, size_t count);
76-
int swoole_coroutine_iouring_rename(const char *oldpath, const char *newpath);
77-
int swoole_coroutine_iouring_mkdir(const char *pathname, mode_t mode);
78-
int swoole_coroutine_iouring_unlink(const char *pathname);
79-
int swoole_coroutine_iouring_fstat(int fd, struct stat *statbuf);
80-
int swoole_coroutine_iouring_stat(const char *path, struct stat *statbuf);
81-
int swoole_coroutine_iouring_lstat(const char *path, struct stat *statbuf);
82-
int swoole_coroutine_iouring_rmdir(const char *pathname);
83-
int swoole_coroutine_iouring_fsync(int fd);
84-
int swoole_coroutine_iouring_fdatasync(int fd);
85-
void swoole_statx_to_stat(const struct statx *statxbuf, struct stat *statbuf);
86-
#endif
8768
/**
8869
* stdio
8970
*/

include/swoole_file_hook.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@
1919

2020
#include "swoole_coroutine_c_api.h"
2121

22-
#ifdef SW_USE_IOURING
23-
#define open(pathname, flags, mode) swoole_coroutine_iouring_open(pathname, flags, mode)
24-
#define close_file(fd) swoole_coroutine_iouring_close_file(fd)
25-
#define read(fd, buf, count) swoole_coroutine_iouring_read(fd, buf, count)
26-
#define write(fd, buf, count) swoole_coroutine_iouring_write(fd, buf, count)
27-
#define rename(oldpath, newpath) swoole_coroutine_iouring_rename(oldpath, newpath)
28-
#define mkdir(pathname, mode) swoole_coroutine_iouring_mkdir(pathname, mode)
29-
#define unlink(pathname) swoole_coroutine_iouring_unlink(pathname)
30-
#define fstat(fd, statbuf) swoole_coroutine_iouring_fstat(fd, statbuf)
31-
#define stat(path, statbuf) swoole_coroutine_iouring_stat(path, statbuf)
32-
#define lstat(path, statbuf) swoole_coroutine_iouring_lstat(path, statbuf)
33-
#define rmdir(pathname) swoole_coroutine_iouring_rmdir(pathname)
34-
#define fsync(fd) swoole_coroutine_iouring_fsync(fd)
35-
#define fdatasync(fd) swoole_coroutine_iouring_fdatasync(fd)
36-
#else
3722
#define open(pathname, flags, mode) swoole_coroutine_open(pathname, flags, mode)
3823
#define close_file(fd) swoole_coroutine_close_file(fd)
3924
#define read(fd, buf, count) swoole_coroutine_read(fd, buf, count)
@@ -49,7 +34,6 @@
4934
#define rename(oldpath, newpath) swoole_coroutine_rename(oldpath, newpath)
5035
#define fsync(fd) swoole_coroutine_fsync(fd)
5136
#define fdatasync(fd) swoole_coroutine_fdatasync(fd)
52-
#endif
5337

5438
#define access(pathname, mode) swoole_coroutine_access(pathname, mode)
5539
#define fopen(pathname, mode) swoole_coroutine_fopen(pathname, mode)

scripts/make.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ COMPILE_PARAMS="--enable-openssl \
77
--enable-swoole-curl \
88
--enable-cares \
99
--enable-swoole-pgsql \
10-
--enable-iouring \
1110
--with-swoole-odbc=unixODBC,/usr \
1211
--enable-swoole-sqlite"
1312

0 commit comments

Comments
 (0)