From: Willy Tarreau Date: Sat, 25 Jan 2014 18:20:35 +0000 (+0100) Subject: REORG: polling: rename the cache allocation functions X-Git-Tag: v1.5-dev22~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=899d95757e74c57feaff9fe0dd62c3327d5681ba;p=thirdparty%2Fhaproxy.git REORG: polling: rename the cache allocation functions - alloc_spec_entry() becomes fd_alloc_cache_entry() - release_spec_entry() becomes fd_release_cache_entry() --- diff --git a/include/proto/fd.h b/include/proto/fd.h index ba082608c1..897c2d357a 100644 --- a/include/proto/fd.h +++ b/include/proto/fd.h @@ -94,22 +94,23 @@ 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) +/* Allocates a cache entry for a file descriptor if it does not yet have one. + * This can be done at any time. + */ +static inline void fd_alloc_cache_entry(const int fd) { if (fdtab[fd].cache) - /* FD already in speculative I/O list */ return; fd_cache_num++; fdtab[fd].cache = fd_cache_num; fd_cache[fd_cache_num-1] = fd; } -/* Removes entry used by fd from the spec list and replaces it with the - * last one. The fdtab.spec is adjusted to match the back reference if needed. +/* Removes entry used by fd from the FD cache and replaces it with the + * last one. The fdtab.cache is adjusted to match the back reference if needed. * If the fd has no entry assigned, return immediately. */ -static inline void release_spec_entry(int fd) +static inline void fd_release_cache_entry(int fd) { unsigned int pos; diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 45f7ceabe3..a15cfc3ddf 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -96,13 +96,12 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) /* This fd doesn't use any active entry anymore, we can * kill its entry. */ - release_spec_entry(fd); + fd_release_cache_entry(fd); } else if ((en & ~eo) & FD_EV_ACTIVE_RW) { - /* we need a new spec entry now */ - alloc_spec_entry(fd); + /* we need a new cache entry now */ + fd_alloc_cache_entry(fd); } - } fdtab[fd].updated = 0; fdtab[fd].new = 0; diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index 3aa3fd164f..af5698beec 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -85,13 +85,12 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) /* This fd doesn't use any active entry anymore, we can * kill its entry. */ - release_spec_entry(fd); + fd_release_cache_entry(fd); } else if ((en & ~eo) & FD_EV_ACTIVE_RW) { - /* we need a new spec entry now */ - alloc_spec_entry(fd); + /* we need a new cache entry now */ + fd_alloc_cache_entry(fd); } - } fdtab[fd].updated = 0; fdtab[fd].new = 0; diff --git a/src/ev_poll.c b/src/ev_poll.c index 6d550a6a82..eff900714c 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -93,13 +93,12 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) /* This fd doesn't use any active entry anymore, we can * kill its entry. */ - release_spec_entry(fd); + fd_release_cache_entry(fd); } else if ((en & ~eo) & FD_EV_ACTIVE_RW) { - /* we need a new spec entry now */ - alloc_spec_entry(fd); + /* we need a new cache entry now */ + fd_alloc_cache_entry(fd); } - } fdtab[fd].updated = 0; fdtab[fd].new = 0; diff --git a/src/ev_select.c b/src/ev_select.c index f79cdbfe8c..df1d1615c3 100644 --- a/src/ev_select.c +++ b/src/ev_select.c @@ -76,13 +76,12 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) /* This fd doesn't use any active entry anymore, we can * kill its entry. */ - release_spec_entry(fd); + fd_release_cache_entry(fd); } else if ((en & ~eo) & FD_EV_ACTIVE_RW) { - /* we need a new spec entry now */ - alloc_spec_entry(fd); + /* we need a new cache entry now */ + fd_alloc_cache_entry(fd); } - } fdtab[fd].updated = 0; fdtab[fd].new = 0; diff --git a/src/fd.c b/src/fd.c index d2638d3bbd..f3d63d92b1 100644 --- a/src/fd.c +++ b/src/fd.c @@ -123,7 +123,7 @@ void fd_delete(int fd) if (cur_poller.clo) cur_poller.clo(fd); - release_spec_entry(fd); + fd_release_cache_entry(fd); fdtab[fd].state &= ~(FD_EV_CURR_MASK | FD_EV_PREV_MASK); port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);