struct fast_task_info add fields: is_client and op_type for io_uring
parent
4576f22e24
commit
7973d81b69
|
|
@ -1,5 +1,6 @@
|
||||||
# Makefile.in
|
# Makefile.in
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
src/tests/Makefile
|
||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
|
||||||
10
make.sh
10
make.sh
|
|
@ -119,6 +119,7 @@ if [ "$uname" = "Linux" ]; then
|
||||||
out=$(grep -F IORING_OP_SEND_ZC /usr/include/liburing/io_uring.h)
|
out=$(grep -F IORING_OP_SEND_ZC /usr/include/liburing/io_uring.h)
|
||||||
if [ -n "$out" ]; then
|
if [ -n "$out" ]; then
|
||||||
IOEVENT_USE=IOEVENT_USE_URING
|
IOEVENT_USE=IOEVENT_USE_URING
|
||||||
|
LIBS="$LIBS -luring"
|
||||||
else
|
else
|
||||||
IOEVENT_USE=IOEVENT_USE_EPOLL
|
IOEVENT_USE=IOEVENT_USE_EPOLL
|
||||||
fi
|
fi
|
||||||
|
|
@ -276,3 +277,12 @@ make $1 $2 $3
|
||||||
if [ "$1" = "clean" ]; then
|
if [ "$1" = "clean" ]; then
|
||||||
/bin/rm -f Makefile _os_define.h
|
/bin/rm -f Makefile _os_define.h
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cd tests
|
||||||
|
cp Makefile.in Makefile
|
||||||
|
sed_replace "s#\\\$(CC)#gcc#g" Makefile
|
||||||
|
sed_replace "s#\\\$(INCS)#$INCS#g" Makefile
|
||||||
|
sed_replace "s#\\\$(LIBS)#$LIBS#g" Makefile
|
||||||
|
if [ "$1" = "clean" ]; then
|
||||||
|
/bin/rm -f Makefile
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ struct sf_network_handler;
|
||||||
struct fast_task_info;
|
struct fast_task_info;
|
||||||
|
|
||||||
#if IOEVENT_USE_URING
|
#if IOEVENT_USE_URING
|
||||||
#define FC_URING_OP_TYPE(task) (task)->event.timer.op_type
|
#define FC_URING_OP_TYPE(task) (task)->uring.op_type
|
||||||
|
#define FC_URING_IS_CLIENT(task) (task)->uring.is_client
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct ioevent_entry
|
typedef struct ioevent_entry
|
||||||
|
|
@ -126,12 +127,20 @@ struct fast_task_info
|
||||||
struct fast_net_buffer_wrapper recv; //recv buffer
|
struct fast_net_buffer_wrapper recv; //recv buffer
|
||||||
|
|
||||||
uint16_t port; //peer port
|
uint16_t port; //peer port
|
||||||
|
|
||||||
|
#if IOEVENT_USE_URING
|
||||||
|
struct {
|
||||||
|
int8_t is_client;
|
||||||
|
uint8_t op_type;
|
||||||
|
} uring; //since v1.0.81
|
||||||
|
#endif
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t current;
|
uint8_t current;
|
||||||
volatile uint8_t notify;
|
volatile uint8_t notify;
|
||||||
} nio_stages; //stages for network IO
|
} nio_stages; //stages for network IO
|
||||||
volatile int8_t reffer_count;
|
|
||||||
volatile int8_t canceled; //if task canceled
|
volatile int8_t canceled; //if task canceled
|
||||||
|
volatile int reffer_count;
|
||||||
int pending_send_count;
|
int pending_send_count;
|
||||||
int64_t req_count; //request count
|
int64_t req_count; //request count
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ typedef struct fast_timer_entry {
|
||||||
struct fast_timer_entry *next;
|
struct fast_timer_entry *next;
|
||||||
int slot_index;
|
int slot_index;
|
||||||
bool rehash;
|
bool rehash;
|
||||||
#if IOEVENT_USE_URING
|
|
||||||
short op_type;
|
|
||||||
#endif
|
|
||||||
} FastTimerEntry;
|
} FastTimerEntry;
|
||||||
|
|
||||||
typedef struct fast_timer_slot {
|
typedef struct fast_timer_slot {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#define IOEVENT_ERROR (EPOLLERR | EPOLLPRI | EPOLLHUP)
|
#define IOEVENT_ERROR (EPOLLERR | EPOLLPRI | EPOLLHUP)
|
||||||
|
|
||||||
#elif IOEVENT_USE_URING
|
#elif IOEVENT_USE_URING
|
||||||
|
#include <sys/mount.h>
|
||||||
#include <liburing.h>
|
#include <liburing.h>
|
||||||
#define IOEVENT_READ POLLIN
|
#define IOEVENT_READ POLLIN
|
||||||
#define IOEVENT_WRITE POLLOUT
|
#define IOEVENT_WRITE POLLOUT
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,10 @@ int ioevent_set(struct fast_task_info *task, struct nio_thread_data *pThread,
|
||||||
__LINE__, sock, result, STRERROR(result));
|
__LINE__, sock, result, STRERROR(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logInfo("file: "__FILE__", line: %d, "
|
||||||
|
"skip uring_prep_recv, fd: %d, port: %d, in progress op type: %d, timeout: %"PRId64,
|
||||||
|
__LINE__, sock, task->port, FC_URING_OP_TYPE(task), task->event.timer.expires);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#define fc_hold_task_ex(task, inc_count) __sync_add_and_fetch( \
|
#define fc_hold_task_ex(task, inc_count) __sync_add_and_fetch( \
|
||||||
&task->reffer_count, inc_count)
|
&task->reffer_count, inc_count)
|
||||||
|
|
||||||
#define fc_hold_task(task) fc_hold_task_ex(task, 1)
|
#define fc_hold_task(task) fc_hold_task_ex(task, 1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
COMPILE = $(CC) -g -O3 -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -DDEBUG_FLAG
|
COMPILE = $(CC) -g -O3 -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -DDEBUG_FLAG
|
||||||
INC_PATH = -I/usr/local/include
|
INC_PATH = $(INCS)
|
||||||
LIB_PATH = -lfastcommon -lpthread
|
LIB_PATH = -lfastcommon $(LIBS)
|
||||||
|
|
||||||
ALL_PRGS = test_allocator test_skiplist test_multi_skiplist test_mblock test_blocked_queue \
|
ALL_PRGS = test_allocator test_skiplist test_multi_skiplist test_mblock test_blocked_queue \
|
||||||
test_id_generator test_ini_parser test_char_convert test_char_convert_loader \
|
test_id_generator test_ini_parser test_char_convert test_char_convert_loader \
|
||||||
Loading…
Reference in New Issue