MINOR: fd: move .et_possible into fdtab[].state

No need to keep this flag apart any more, let's merge it into the global
state.
This commit is contained in:
Willy Tarreau 2021-04-06 18:05:48 +02:00
parent 0cc612818d
commit 5362bc9044
3 changed files with 4 additions and 4 deletions

View File

@ -66,6 +66,7 @@ enum {
#define FD_LINGER_RISK_BIT 16 /* must kill lingering before closing */
#define FD_CLONED_BIT 17 /* cloned socket, requires EPOLL_CTL_DEL on close */
#define FD_INITIALIZED_BIT 18 /* init phase was done (e.g. output pipe set non-blocking) */
#define FD_ET_POSSIBLE_BIT 19 /* edge-triggered is possible on this FD */
/* and flag values */
@ -103,6 +104,7 @@ enum {
#define FD_LINGER_RISK (1U << FD_LINGER_RISK_BIT)
#define FD_CLONED (1U << FD_CLONED_BIT)
#define FD_INITIALIZED (1U << FD_INITIALIZED_BIT)
#define FD_ET_POSSIBLE (1U << FD_ET_POSSIBLE_BIT)
/* This is the value used to mark a file descriptor as dead. This value is
* negative, this is important so that tests on fd < 0 properly match. It
@ -151,7 +153,6 @@ struct fdtab {
void (*iocb)(int fd); /* I/O handler */
void *owner; /* the connection or listener associated with this fd, NULL if closed */
unsigned int state; /* FD state for read and write directions (FD_EV_*) + FD_POLL_* */
unsigned char et_possible:1; /* 1 if edge-triggered is possible on this FD */
unsigned char exported:1; /* 1 if the FD is exported and must not be closed */
#ifdef DEBUG_FD
unsigned int event_count; /* number of events reported */

View File

@ -433,7 +433,6 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned
fdtab[fd].owner = owner;
fdtab[fd].iocb = iocb;
fdtab[fd].state = 0;
fdtab[fd].et_possible = 0;
fdtab[fd].exported = 0;
#ifdef DEBUG_FD
fdtab[fd].event_count = 0;
@ -441,7 +440,7 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned
/* conn_fd_handler should support edge-triggered FDs */
if ((global.tune.options & GTUNE_FD_ET) && fdtab[fd].iocb == sock_conn_iocb)
fdtab[fd].et_possible = 1;
fdtab[fd].state |= FD_ET_POSSIBLE;
fdtab[fd].thread_mask = thread_mask;
/* note: do not reset polled_mask here as it indicates which poller

View File

@ -60,7 +60,7 @@ static void _update_fd(int fd)
en = fdtab[fd].state;
/* Try to force EPOLLET on FDs that support it */
if (fdtab[fd].et_possible) {
if (fdtab[fd].state & FD_ET_POSSIBLE) {
/* already done ? */
if (polled_mask[fd].poll_recv & polled_mask[fd].poll_send & tid_bit)
return;