]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: fd: remove unused cb->b pointers in the struct fdtab
authorWilly Tarreau <w@1wt.eu>
Sat, 12 May 2012 22:35:44 +0000 (00:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 May 2012 22:35:44 +0000 (00:35 +0200)
These pointers were used to hold pointers to buffers in the past, but
since we introduced the stream interface, they're no longer used but
they were still sometimes set.

Removing them shrink the struct fdtab from 32 to 24 bytes on 32-bit machines,
and from 52 to 36 bytes on 64-bit machines, which is a significant saving. A
quick tests shows a steady 0.5% performance gain, probably due to the better
cache efficiency.

include/types/fd.h
src/checks.c
src/proto_tcp.c
src/proto_uxst.c
src/session.c

index f69886354b6abccb2aa8e3972fb8896edc109fbb..559fa0e701d496331c451547dfcd137afa7c4305 100644 (file)
@@ -69,7 +69,6 @@ enum {
 struct fdtab {
        struct {
                int (*f)(int fd);            /* read/write function */
-               struct buffer *b;            /* read/write buffer */
        } cb[DIR_SIZE];
        void *owner;                         /* the session (or proxy) associated with this fd */
        struct {                             /* used by pollers which support speculative polling */
index f8ad53e160709800a14993063ad6d0bbbedd0b04..3604e5a0e08572197a9a4dd1f16c83a1c5520fdf 100644 (file)
@@ -1434,9 +1434,7 @@ static struct task *process_chk(struct task *t)
                                                fd_insert(fd);
                                                fdtab[fd].owner = t;
                                                fdtab[fd].cb[DIR_RD].f = &event_srv_chk_r;
-                                               fdtab[fd].cb[DIR_RD].b = NULL;
                                                fdtab[fd].cb[DIR_WR].f = &event_srv_chk_w;
-                                               fdtab[fd].cb[DIR_WR].b = NULL;
                                                fdinfo[fd].peeraddr = (struct sockaddr *)&sa;
                                                fdinfo[fd].peerlen = get_addr_len(&sa);
                                                fdtab[fd].state = FD_STCONN; /* connection in progress */
index eee65bc9bf38cb6f2ba7fc497fefa77f325209fb..416dbf07c8c807ccf0878ae316d3691f87ede2db 100644 (file)
@@ -451,8 +451,6 @@ int tcp_connect_server(struct stream_interface *si)
        fdtab[fd].owner = si;
        fdtab[fd].state = FD_STCONN; /* connection in progress */
        fdtab[fd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY;
-       fdtab[fd].cb[DIR_RD].b = si->ib;
-       fdtab[fd].cb[DIR_WR].b = si->ob;
 
        /* If we have nothing to send or if we want to initialize the sock layer,
         * we want to confirm that the TCP connection is established before doing
@@ -755,7 +753,6 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
        fdtab[fd].flags = FD_FL_TCP | ((listener->options & LI_O_NOLINGER) ? FD_FL_TCP_NOLING : 0);
        fdtab[fd].cb[DIR_RD].f = listener->proto->accept;
        fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
-       fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
 
        fdinfo[fd].peeraddr = NULL;
        fdinfo[fd].peerlen = 0;
index 08259920177287fb20ae2101798afca7f8c1b6b0..dec91aaf0a53fa949cda5a0771c1ecc1b2275155 100644 (file)
@@ -264,7 +264,6 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
        fd_insert(fd);
        fdtab[fd].cb[DIR_RD].f = listener->proto->accept;
        fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
-       fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
        fdtab[fd].owner = listener; /* reference the listener instead of a task */
        fdtab[fd].state = FD_STLISTEN;
        fdinfo[fd].peeraddr = NULL;
index ae20e5b38b16a6f3fc4d33739d87296b55b95104..036480c837d8d20fe6e4315ce9719f3d33956256 100644 (file)
@@ -284,9 +284,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        fdtab[cfd].state = FD_STREADY;
        fdtab[cfd].flags = 0;
        fdtab[cfd].cb[DIR_RD].f = s->si[0].sock.read;
-       fdtab[cfd].cb[DIR_RD].b = s->req;
        fdtab[cfd].cb[DIR_WR].f = s->si[0].sock.write;
-       fdtab[cfd].cb[DIR_WR].b = s->rep;
        fdinfo[cfd].peeraddr = (struct sockaddr *)&s->si[0].addr.from;
        fdinfo[cfd].peerlen  = sizeof(s->si[0].addr.from);
        EV_FD_SET(cfd, DIR_RD);