CLEANUP: fd: remove unused cb->b pointers in the struct fdtab

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.
This commit is contained in:
Willy Tarreau 2012-05-13 00:35:44 +02:00
parent 3d2f16f3c3
commit b147a8382a
5 changed files with 0 additions and 9 deletions

View 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 */

View 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 */

View 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;

View 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;

View 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);