]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: polling: rename "spec_e" to "state" and "spec_p" to "cache"
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Jan 2014 10:09:39 +0000 (11:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 25 Jan 2014 23:42:29 +0000 (00:42 +0100)
We're completely changing the way FDs will be polled. There will be no
more speculative I/O since we'll know the exact FD state, so these will
only be cached events.

First, let's fix a few field names which become confusing. "spec_e" was
used to store a speculative I/O event state. Now we'll store the whole
R/W states for the FD there. "spec_p" was used to store a speculative
I/O cache position. Now let's clearly call it "cache".

include/proto/fd.h
include/types/fd.h
src/dumpstats.c
src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c

index a67a3203d6cbc139ff4f981b7421dc0eb1cc122c..3563a089d9b4a9fb912989a29024966f1084c674 100644 (file)
@@ -97,11 +97,11 @@ static inline void updt_fd(const int fd)
 /* allocate an entry for a speculative event. This can be done at any time. */
 static inline void alloc_spec_entry(const int fd)
 {
-       if (fdtab[fd].spec_p)
+       if (fdtab[fd].cache)
                /* FD already in speculative I/O list */
                return;
        fd_nbspec++;
-       fdtab[fd].spec_p = fd_nbspec;
+       fdtab[fd].cache = fd_nbspec;
        fd_spec[fd_nbspec-1] = fd;
 }
 
@@ -113,16 +113,16 @@ static inline void release_spec_entry(int fd)
 {
        unsigned int pos;
 
-       pos = fdtab[fd].spec_p;
+       pos = fdtab[fd].cache;
        if (!pos)
                return;
-       fdtab[fd].spec_p = 0;
+       fdtab[fd].cache = 0;
        fd_nbspec--;
        if (likely(pos <= fd_nbspec)) {
                /* was not the last entry */
                fd = fd_spec[fd_nbspec];
                fd_spec[pos - 1] = fd;
-               fdtab[fd].spec_p = pos;
+               fdtab[fd].cache = pos;
        }
 }
 
index 23550cbfcebcf0f55a21c3589f63d5291579018a..3bfe48fa9ce87a691334d0a1420dc9719e056d6e 100644 (file)
@@ -69,8 +69,8 @@ enum {
 struct fdtab {
        int (*iocb)(int fd);                 /* I/O handler, returns FD_WAIT_* */
        void *owner;                         /* the connection or listener associated with this fd, NULL if closed */
-       unsigned int  spec_p;                /* speculative polling: position in spec list+1. 0=not in list. */
-       unsigned char state;                 /* FD state for read and write directions */
+       unsigned int  cache;                 /* position+1 in the FD cache. 0=not in cache. */
+       unsigned char state;                 /* FD state for read and write directions (4+4 bits) */
        unsigned char ev;                    /* event seen in return of poll() : FD_POLL_* */
        unsigned char new:1;                 /* 1 if this fd has just been created */
        unsigned char updated:1;             /* 1 if this fd is already in the update list */
index f861650d57bea52695c98867ebfb185346002619..aabb556f2a409fc2930fa2dfcaf4c3b74187ac9d 100644 (file)
@@ -4529,7 +4529,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct se
                                      conn->flags,
                                      conn->t.sock.fd,
                                      conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].state : 0,
-                                     conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].spec_p : 0,
+                                     conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].cache : 0,
                                      conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].updated : 0);
                }
                else if ((tmpctx = objt_appctx(sess->si[0].end)) != NULL) {
@@ -4557,7 +4557,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct se
                                      conn->flags,
                                      conn->t.sock.fd,
                                      conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].state : 0,
-                                     conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].spec_p : 0,
+                                     conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].cache : 0,
                                      conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].updated : 0);
                }
                else if ((tmpctx = objt_appctx(sess->si[1].end)) != NULL) {
index ba0025b20f1b73fa1600b2d84dc85407a951d37c..e826af3cb0726998c58906f2da9f8039a8cb8e61 100644 (file)
@@ -187,7 +187,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        if (fdtab[fd].ev & FD_POLL_OUT)
                                fd_ev_set(fd, DIR_WR);
 
-                       if (fdtab[fd].spec_p) {
+                       if (fdtab[fd].cache) {
                                /* This fd was already scheduled for being called as a speculative I/O */
                                continue;
                        }
index ca14eeb0ff4e1f65806cf224636be0829ffa9a39..d59a5706ea6bccd25302f1a12065c46b16098f3a 100644 (file)
@@ -158,7 +158,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        if (fdtab[fd].ev & FD_POLL_OUT)
                                fd_ev_set(fd, DIR_WR);
 
-                       if (fdtab[fd].spec_p) {
+                       if (fdtab[fd].cache) {
                                /* This fd was already scheduled for being
                                 * called as a speculative I/O.
                                 */
index 8b3f5959972d3706030e65cc6fb28f771357581a..6a97c98d692441804d03d7fe5c8fc087f95dd917 100644 (file)
@@ -183,7 +183,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        if (fdtab[fd].ev & FD_POLL_OUT)
                                fd_ev_set(fd, DIR_WR);
 
-                       if (fdtab[fd].spec_p) {
+                       if (fdtab[fd].cache) {
                                /* This fd was already scheduled for being
                                 * called as a speculative I/O
                                 */
index 300cffa1483c250c49180f61f3b034311f640e91..14f1b1e8c6c3be302d3467634346b95492ce162a 100644 (file)
@@ -167,7 +167,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                                if (fdtab[fd].ev & FD_POLL_OUT)
                                        fd_ev_set(fd, DIR_WR);
 
-                               if (fdtab[fd].spec_p) {
+                               if (fdtab[fd].cache) {
                                        /* This fd was already scheduled for being
                                         * called as a speculative I/O.
                                         */