]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: move .et_possible into fdtab[].state
authorWilly Tarreau <w@1wt.eu>
Tue, 6 Apr 2021 16:05:48 +0000 (18:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Apr 2021 16:09:43 +0000 (18:09 +0200)
No need to keep this flag apart any more, let's merge it into the global
state.

include/haproxy/fd-t.h
include/haproxy/fd.h
src/ev_epoll.c

index cfcde398b2c756627f5f1b3eb9daf7732aeb7f31..e60f3b52fb791d02795e7ec8a502dbc865c7e18f 100644 (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 */
index 11dce3d9df4bad4249bd38276c548214c97cb84a..ba9bf8c222cc8df2ee6da27b245a3e091cecce30 100644 (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
index 22ad454c8d7982f5a26b016cddb5719ca20e9dce..27dbdb29ce99af5a73addef8a12b041ab5a89a34 100644 (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;