]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: remove the now unused fdtab direct I/O callbacks
authorWilly Tarreau <wtarreau@exceliance.fr>
Fri, 6 Jul 2012 14:02:29 +0000 (16:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 2 Sep 2012 19:51:29 +0000 (21:51 +0200)
They were all left to NULL since last commit so we can safely remove them
all now and remove the temporary dual polling logic in pollers.

include/types/fd.h
src/checks.c
src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/ev_sepoll.c
src/proto_tcp.c
src/proto_uxst.c
src/session.c

index 54a78d6b197eba55cb83365f36e431bd1fc6e791..684b77abd9cb481aad349bba721020fa716312f3 100644 (file)
@@ -66,9 +66,6 @@ enum {
 /* info about one given fd */
 struct fdtab {
        int (*iocb)(int fd);                 /* I/O handler, returns FD_WAIT_* */
-       struct {
-               int (*f)(int fd);            /* read/write function */
-       } cb[DIR_SIZE];
        void *owner;                         /* the connection or listener associated with this fd, NULL if closed */
        struct {                             /* used by pollers which support speculative polling */
                unsigned char e;             /* read and write events status. 4 bits, may be merged into flags' lower bits */
index d3861687d42377566ffc060d887cbaf10022beec..f63edef39bbbd3122534d557aa4abaf9ff78fa7b 100644 (file)
@@ -1482,8 +1482,6 @@ static struct task *process_chk(struct task *t)
                                                s->check_conn->flags = CO_FL_WAIT_L4_CONN; /* TCP connection pending */
                                                fd_insert(fd);
                                                fdtab[fd].owner = t;
-                                               fdtab[fd].cb[DIR_RD].f = NULL;
-                                               fdtab[fd].cb[DIR_WR].f = NULL;
                                                fdtab[fd].iocb = &check_iocb;
                                                fdtab[fd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY;
                                                EV_FD_SET(fd, DIR_WR);  /* for connect status */
index 589932fd40d735eac2cc86e65cbb60af2e75925b..63782d3ef292ab19a797d7d00af859df9a2a7210 100644 (file)
@@ -245,6 +245,9 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                int e = epoll_events[count].events;
                fd = epoll_events[count].data.fd;
 
+               if (!fdtab[fd].owner)
+                       continue;
+
                /* it looks complicated but gcc can optimize it away when constants
                 * have same values.
                 */
@@ -256,22 +259,6 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        ((e & EPOLLERR) ? FD_POLL_ERR : 0) |
                        ((e & EPOLLHUP) ? FD_POLL_HUP : 0);
 
-               if ((fd_evts[FD2OFS(fd)] >> FD2BIT(fd)) & DIR2MSK(DIR_RD)) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_IN|FD_POLL_HUP|FD_POLL_ERR))
-                               if (fdtab[fd].cb[DIR_RD].f)
-                                       fdtab[fd].cb[DIR_RD].f(fd);
-               }
-
-               if ((fd_evts[FD2OFS(fd)] >> FD2BIT(fd)) & DIR2MSK(DIR_WR)) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_OUT|FD_POLL_ERR|FD_POLL_HUP))
-                               if (fdtab[fd].cb[DIR_WR].f)
-                                       fdtab[fd].cb[DIR_WR].f(fd);
-               }
-
                if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
                        fdtab[fd].iocb(fd);
        }
index 556abccb23d091dcc591eee6c7909cee72f59f32..3d12e36bf045f7a1400c1aaeca30df97e09418f8 100644 (file)
@@ -139,25 +139,20 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
        for (count = 0; count < status; count++) {
                fd = kev[count].ident;
 
+               if (!fdtab[fd].owner)
+                       continue;
+
                fdtab[fd].ev &= FD_POLL_STICKY;
                if (kev[count].filter ==  EVFILT_READ) {
                        if (FD_ISSET(fd, fd_evts[DIR_RD])) {
-                               if (!fdtab[fd].owner)
-                                       continue;
                                fdtab[fd].ev |= FD_POLL_IN;
-                               if (fdtab[fd].cb[DIR_RD].f)
-                                       fdtab[fd].cb[DIR_RD].f(fd);
                        }
                } else if (kev[count].filter ==  EVFILT_WRITE) {
                        if (FD_ISSET(fd, fd_evts[DIR_WR])) {
-                               if (!fdtab[fd].owner)
-                                       continue;
                                fdtab[fd].ev |= FD_POLL_OUT;
-                               if (fdtab[fd].cb[DIR_WR].f)
-                                       fdtab[fd].cb[DIR_WR].f(fd)
                        }
                }
-               if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
+               if (fdtab[fd].iocb && fdtab[fd].ev)
                        fdtab[fd].iocb(fd);
        }
 }
index 015ff76c277b1fa963844c1552ec2a8bac46868a..cb210f72010ca2be3241c527dbc5c3afbde0868b 100644 (file)
@@ -149,6 +149,12 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                if (!(e & ( POLLOUT | POLLIN | POLLERR | POLLHUP )))
                        continue;
 
+               /* ok, we found one active fd */
+               status--;
+
+               if (!fdtab[fd].owner)
+                       continue;
+
                fdtab[fd].ev &= FD_POLL_STICKY;
                fdtab[fd].ev |=
                        ((e & POLLIN ) ? FD_POLL_IN  : 0) |
@@ -156,25 +162,6 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        ((e & POLLERR) ? FD_POLL_ERR : 0) |
                        ((e & POLLHUP) ? FD_POLL_HUP : 0);
 
-               /* ok, we found one active fd */
-               status--;
-
-               if (FD_ISSET(fd, fd_evts[DIR_RD])) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_IN|FD_POLL_HUP|FD_POLL_ERR))
-                               if (fdtab[fd].cb[DIR_RD].f)
-                                       fdtab[fd].cb[DIR_RD].f(fd);
-               }
-         
-               if (FD_ISSET(fd, fd_evts[DIR_WR])) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_OUT|FD_POLL_ERR|FD_POLL_HUP))
-                               if (fdtab[fd].cb[DIR_WR].f)
-                                       fdtab[fd].cb[DIR_WR].f(fd);
-               }
-
                if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
                        fdtab[fd].iocb(fd);
        }
index b1c41bc87f463425ed8d7820fd3403d96bcf5e41..c5d39366991cee6c7c58399b481953b3b2c0a8fe 100644 (file)
@@ -146,22 +146,15 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        /* if we specify read first, the accepts and zero reads will be
                         * seen first. Moreover, system buffers will be flushed faster.
                         */
+                       if (!fdtab[fd].owner)
+                               continue;
+
                        fdtab[fd].ev &= FD_POLL_STICKY;
-                       if (FD_ISSET(fd, tmp_evts[DIR_RD])) {
-                               if (!fdtab[fd].owner)
-                                       continue;
+                       if (FD_ISSET(fd, tmp_evts[DIR_RD]))
                                fdtab[fd].ev |= FD_POLL_IN;
-                               if (fdtab[fd].cb[DIR_RD].f)
-                                       fdtab[fd].cb[DIR_RD].f(fd);
-                       }
 
-                       if (FD_ISSET(fd, tmp_evts[DIR_WR])) {
-                               if (!fdtab[fd].owner)
-                                       continue;
+                       if (FD_ISSET(fd, tmp_evts[DIR_WR]))
                                fdtab[fd].ev |= FD_POLL_OUT;
-                               if (fdtab[fd].cb[DIR_WR].f)
-                                       fdtab[fd].cb[DIR_WR].f(fd);
-                       }
 
                        if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
                                fdtab[fd].iocb(fd);
index 55c81eab9bb3506c6bbe27796e3b03f5d9a3d7b1..5d93bf2a989e2dab0c17e9c629bde7d2e8a4d5b3 100644 (file)
@@ -398,6 +398,9 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                int e = epoll_events[count].events;
                fd = epoll_events[count].data.fd;
 
+               if (!fdtab[fd].owner)
+                       continue;
+
                /* it looks complicated but gcc can optimize it away when constants
                 * have same values.
                 */
@@ -409,22 +412,6 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        ((e & EPOLLERR) ? FD_POLL_ERR : 0) |
                        ((e & EPOLLHUP) ? FD_POLL_HUP : 0);
 
-               if ((fdtab[fd].spec.e & FD_EV_MASK_R) == FD_EV_WAIT_R) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_IN|FD_POLL_HUP|FD_POLL_ERR))
-                               if (fdtab[fd].cb[DIR_RD].f)
-                                       fdtab[fd].cb[DIR_RD].f(fd);
-               }
-
-               if ((fdtab[fd].spec.e & FD_EV_MASK_W) == FD_EV_WAIT_W) {
-                       if (!fdtab[fd].owner)
-                               continue;
-                       if (fdtab[fd].ev & (FD_POLL_OUT|FD_POLL_ERR))
-                               if (fdtab[fd].cb[DIR_WR].f)
-                                       fdtab[fd].cb[DIR_WR].f(fd);
-               }
-
                if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
                        fdtab[fd].iocb(fd);
        }
@@ -455,21 +442,11 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                 */
 
                fdtab[fd].ev &= FD_POLL_STICKY;
-               if ((eo & FD_EV_MASK_R) == FD_EV_SPEC_R) {
-                       /* The owner is interested in reading from this FD */
-                       /* Pretend there is something to read */
+               if ((eo & FD_EV_MASK_R) == FD_EV_SPEC_R)
                        fdtab[fd].ev |= FD_POLL_IN;
-                       if (fdtab[fd].cb[DIR_RD].f && !fdtab[fd].cb[DIR_RD].f(fd))
-                               fdtab[fd].spec.e ^= (FD_EV_WAIT_R ^ FD_EV_SPEC_R);
-               }
 
-               if ((eo & FD_EV_MASK_W) == FD_EV_SPEC_W) {
-                       /* The owner is interested in writing to this FD */
-                       /* Pretend there is something to write */
+               if ((eo & FD_EV_MASK_W) == FD_EV_SPEC_W)
                        fdtab[fd].ev |= FD_POLL_OUT;
-                       if (fdtab[fd].cb[DIR_WR].f && !fdtab[fd].cb[DIR_WR].f(fd))
-                               fdtab[fd].spec.e ^= (FD_EV_WAIT_W ^ FD_EV_SPEC_W);
-               }
 
                if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev) {
                        int wait = fdtab[fd].iocb(fd);
index db2fe031050ae707cac50b0edfeb436756a7da0e..c1a3e6ff0c67db7f5d2aab5b270e3e1ebb725b19 100644 (file)
@@ -468,14 +468,7 @@ int tcp_connect_server(struct stream_interface *si)
        fdtab[fd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY;
        si->conn.flags  = CO_FL_WAIT_L4_CONN; /* connection in progress */
 
-       /* Prepare to send a few handshakes related to the on-wire protocol.
-        * If we have nothing to send, we want to confirm that the TCP
-        * connection is established before doing so, so we use our own write
-        * callback then switch to the sock layer.
-        */
-       fdtab[fd].cb[DIR_RD].f = NULL;
-       fdtab[fd].cb[DIR_WR].f = NULL;
-
+       /* Prepare to send a few handshakes related to the on-wire protocol. */
        if (si->send_proxy_ofs)
                si->conn.flags |= CO_FL_SI_SEND_PROXY;
 
@@ -575,11 +568,10 @@ int tcp_connect_probe(int fd)
         */
        b->flags |= BF_WRITE_NULL;
 
-       /* The FD is ready now, we can hand the handlers to the socket layer
-        * and forward the event there to start working on the socket.
+       /* The FD is ready now, we'll mark the connection as complete and
+        * forward the event to the data layer which will update the stream
+        * interface flags.
         */
-       fdtab[fd].cb[DIR_RD].f = NULL;
-       fdtab[fd].cb[DIR_WR].f = NULL;
        conn->flags &= ~CO_FL_WAIT_L4_CONN;
        si->exp = TICK_ETERNITY;
        return si_data(si)->write(fd);
@@ -739,8 +731,6 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
        fdtab[fd].owner = listener; /* reference the listener instead of a task */
        fdtab[fd].flags = FD_FL_TCP | ((listener->options & LI_O_NOLINGER) ? FD_FL_TCP_NOLING : 0);
        fdtab[fd].iocb = listener->proto->accept;
-       fdtab[fd].cb[DIR_RD].f = NULL; /* never called */
-       fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
        fd_insert(fd);
 
  tcp_return:
index b1484b62a2200590785c619c62f7447bb400ac94..bd0d7886c49d6cbd4e4a5c8666a66405e2671f0b 100644 (file)
@@ -263,8 +263,6 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
        /* the function for the accept() event */
        fd_insert(fd);
        fdtab[fd].iocb = listener->proto->accept;
-       fdtab[fd].cb[DIR_RD].f = NULL; /* never called */
-       fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
        fdtab[fd].owner = listener; /* reference the listener instead of a task */
        return ERR_NONE;
  err_rename:
index 998270b33882db5aa21421c8927d657ebb2be66e..8c649e74833da5227c1ced4ac549488ab565ea94 100644 (file)
@@ -283,8 +283,6 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        fd_insert(cfd);
        fdtab[cfd].owner = &s->si[0].conn;
        fdtab[cfd].flags = 0;
-       fdtab[cfd].cb[DIR_RD].f = NULL;
-       fdtab[cfd].cb[DIR_WR].f = NULL;
        fdtab[cfd].iocb = conn_fd_handler;
        EV_FD_SET(cfd, DIR_RD);