From 5362bc90442a729e0652d514a95e104508ecb811 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 6 Apr 2021 18:05:48 +0200 Subject: [PATCH] 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. --- include/haproxy/fd-t.h | 3 ++- include/haproxy/fd.h | 3 +-- src/ev_epoll.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/haproxy/fd-t.h b/include/haproxy/fd-t.h index cfcde398b..e60f3b52f 100644 --- a/include/haproxy/fd-t.h +++ b/include/haproxy/fd-t.h @@ -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 */ diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h index 11dce3d9d..ba9bf8c22 100644 --- a/include/haproxy/fd.h +++ b/include/haproxy/fd.h @@ -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 diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 22ad454c8..27dbdb29c 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -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;