mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
REORG: polling: rename the cache allocation functions
- alloc_spec_entry() becomes fd_alloc_cache_entry() - release_spec_entry() becomes fd_release_cache_entry()
This commit is contained in:
parent
16f649c82c
commit
899d95757e
@ -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. */
|
/* Allocates a cache entry for a file descriptor if it does not yet have one.
|
||||||
static inline void alloc_spec_entry(const int fd)
|
* This can be done at any time.
|
||||||
|
*/
|
||||||
|
static inline void fd_alloc_cache_entry(const int fd)
|
||||||
{
|
{
|
||||||
if (fdtab[fd].cache)
|
if (fdtab[fd].cache)
|
||||||
/* FD already in speculative I/O list */
|
|
||||||
return;
|
return;
|
||||||
fd_cache_num++;
|
fd_cache_num++;
|
||||||
fdtab[fd].cache = fd_cache_num;
|
fdtab[fd].cache = fd_cache_num;
|
||||||
fd_cache[fd_cache_num-1] = fd;
|
fd_cache[fd_cache_num-1] = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Removes entry used by fd <fd> from the spec list and replaces it with the
|
/* Removes entry used by fd <fd> from the FD cache and replaces it with the
|
||||||
* last one. The fdtab.spec is adjusted to match the back reference if needed.
|
* last one. The fdtab.cache is adjusted to match the back reference if needed.
|
||||||
* If the fd has no entry assigned, return immediately.
|
* 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;
|
unsigned int pos;
|
||||||
|
|
||||||
|
@ -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
|
/* This fd doesn't use any active entry anymore, we can
|
||||||
* kill its entry.
|
* kill its entry.
|
||||||
*/
|
*/
|
||||||
release_spec_entry(fd);
|
fd_release_cache_entry(fd);
|
||||||
}
|
}
|
||||||
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
||||||
/* we need a new spec entry now */
|
/* we need a new cache entry now */
|
||||||
alloc_spec_entry(fd);
|
fd_alloc_cache_entry(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fdtab[fd].updated = 0;
|
fdtab[fd].updated = 0;
|
||||||
fdtab[fd].new = 0;
|
fdtab[fd].new = 0;
|
||||||
|
@ -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
|
/* This fd doesn't use any active entry anymore, we can
|
||||||
* kill its entry.
|
* kill its entry.
|
||||||
*/
|
*/
|
||||||
release_spec_entry(fd);
|
fd_release_cache_entry(fd);
|
||||||
}
|
}
|
||||||
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
||||||
/* we need a new spec entry now */
|
/* we need a new cache entry now */
|
||||||
alloc_spec_entry(fd);
|
fd_alloc_cache_entry(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fdtab[fd].updated = 0;
|
fdtab[fd].updated = 0;
|
||||||
fdtab[fd].new = 0;
|
fdtab[fd].new = 0;
|
||||||
|
@ -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
|
/* This fd doesn't use any active entry anymore, we can
|
||||||
* kill its entry.
|
* kill its entry.
|
||||||
*/
|
*/
|
||||||
release_spec_entry(fd);
|
fd_release_cache_entry(fd);
|
||||||
}
|
}
|
||||||
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
||||||
/* we need a new spec entry now */
|
/* we need a new cache entry now */
|
||||||
alloc_spec_entry(fd);
|
fd_alloc_cache_entry(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fdtab[fd].updated = 0;
|
fdtab[fd].updated = 0;
|
||||||
fdtab[fd].new = 0;
|
fdtab[fd].new = 0;
|
||||||
|
@ -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
|
/* This fd doesn't use any active entry anymore, we can
|
||||||
* kill its entry.
|
* kill its entry.
|
||||||
*/
|
*/
|
||||||
release_spec_entry(fd);
|
fd_release_cache_entry(fd);
|
||||||
}
|
}
|
||||||
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
else if ((en & ~eo) & FD_EV_ACTIVE_RW) {
|
||||||
/* we need a new spec entry now */
|
/* we need a new cache entry now */
|
||||||
alloc_spec_entry(fd);
|
fd_alloc_cache_entry(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fdtab[fd].updated = 0;
|
fdtab[fd].updated = 0;
|
||||||
fdtab[fd].new = 0;
|
fdtab[fd].new = 0;
|
||||||
|
2
src/fd.c
2
src/fd.c
@ -123,7 +123,7 @@ void fd_delete(int fd)
|
|||||||
if (cur_poller.clo)
|
if (cur_poller.clo)
|
||||||
cur_poller.clo(fd);
|
cur_poller.clo(fd);
|
||||||
|
|
||||||
release_spec_entry(fd);
|
fd_release_cache_entry(fd);
|
||||||
fdtab[fd].state &= ~(FD_EV_CURR_MASK | FD_EV_PREV_MASK);
|
fdtab[fd].state &= ~(FD_EV_CURR_MASK | FD_EV_PREV_MASK);
|
||||||
|
|
||||||
port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
|
port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user