]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: make updt_fd_polling() a normal function
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Sep 2019 11:25:41 +0000 (13:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Sep 2019 07:31:18 +0000 (09:31 +0200)
It's called from many places, better use a real function than an inline.

include/proto/fd.h
src/fd.c

index b072b30445cd7e5bfadaa313d026d204fe02a0a1..4b932357ff9bb162d695fb7afd7982062685046d 100644 (file)
@@ -104,31 +104,7 @@ void run_poller();
 
 void fd_add_to_fd_list(volatile struct fdlist *list, int fd, int off);
 void fd_rm_from_fd_list(volatile struct fdlist *list, int fd, int off);
-
-/* Mark fd <fd> as updated for polling and allocate an entry in the update list
- * for this if it was not already there. This can be done at any time.
- */
-static inline void updt_fd_polling(const int fd)
-{
-       if ((fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {
-
-               /* note: we don't have a test-and-set yet in hathreads */
-
-               if (HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid))
-                       return;
-
-               fd_updt[fd_nbupdt++] = fd;
-       } else {
-               unsigned long update_mask = fdtab[fd].update_mask;
-               do {
-                       if (update_mask == fdtab[fd].thread_mask)
-                               return;
-               } while (!_HA_ATOMIC_CAS(&fdtab[fd].update_mask, &update_mask,
-                   fdtab[fd].thread_mask));
-               fd_add_to_fd_list(&update_list, fd, offsetof(struct fdtab, update));
-       }
-
-}
+void updt_fd_polling(const int fd);
 
 /* Called from the poller to acknoledge we read an entry from the global
  * update list, to remove our bit from the update_mask, and remove it from
index 183c57375f1caf65a0f37465667e826bf75532d7..6bfefdddc889758d6b59f1c4f315a4c3935cc2f3 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -337,6 +337,27 @@ void fd_remove(int fd)
        fd_dodelete(fd, 0);
 }
 
+void updt_fd_polling(const int fd)
+{
+       if ((fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {
+
+               /* note: we don't have a test-and-set yet in hathreads */
+
+               if (HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid))
+                       return;
+
+               fd_updt[fd_nbupdt++] = fd;
+       } else {
+               unsigned long update_mask = fdtab[fd].update_mask;
+               do {
+                       if (update_mask == fdtab[fd].thread_mask)
+                               return;
+               } while (!_HA_ATOMIC_CAS(&fdtab[fd].update_mask, &update_mask,
+                   fdtab[fd].thread_mask));
+               fd_add_to_fd_list(&update_list, fd, offsetof(struct fdtab, update));
+       }
+}
+
 /* Tries to send <npfx> parts from <prefix> followed by <nmsg> parts from <msg>
  * optionally followed by a newline if <nl> is non-null, to file descriptor
  * <fd>. The message is sent atomically using writev(). It may be truncated to