From: Olivier Houchard Date: Tue, 17 Dec 2024 14:40:41 +0000 (+0100) Subject: CLEANUP: queues: Remove pendconn_grab_from_px(). X-Git-Tag: v3.2-dev2~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3cd5a4b8689c99fef4f4bc4e8713ce3ef8db040;p=thirdparty%2Fhaproxy.git CLEANUP: queues: Remove pendconn_grab_from_px(). pendconn_grab_from_px() is now unused, so just remove it. --- diff --git a/include/haproxy/queue.h b/include/haproxy/queue.h index e4201fb174..12dde86794 100644 --- a/include/haproxy/queue.h +++ b/include/haproxy/queue.h @@ -37,7 +37,6 @@ int pendconn_dequeue(struct stream *strm); void process_srv_queue(struct server *s); unsigned int srv_dynamic_maxconn(const struct server *s); int pendconn_redistribute(struct server *s); -int pendconn_grab_from_px(struct server *s); void pendconn_unlink(struct pendconn *p); int pendconn_must_try_again(struct pendconn *p); diff --git a/src/queue.c b/src/queue.c index a5537fce2f..62fa7dd652 100644 --- a/src/queue.c +++ b/src/queue.c @@ -54,17 +54,17 @@ s * queue's lock. * - the pendconn is unlinked either by its own stream upon success/abort/ * free, or by another one offering it its server slot. This is achieved by * pendconn_process_next_strm() under either the server or proxy's lock, - * pendconn_redistribute() under the server's lock, pendconn_grab_from_px() - * under the proxy's lock, or pendconn_unlink() under either the proxy's or - * the server's lock depending on the queue the pendconn is attached to. + * pendconn_redistribute() under the server's lock, or pendconn_unlink() + * under either the proxy's or the server's lock depending + * on the queue the pendconn is attached to. * * - no single operation except the pendconn initialisation prior to the * insertion are performed without eithre a queue lock held or the element * being unlinked and visible exclusively to its stream. * - * - pendconn_grab_from_px() and pendconn_process_next_strm() assign ->target - * so that the stream knows what server to work with (via - * pendconn_dequeue() which sets it on strm->target). + * - pendconn_process_next_strm() assign ->target so that the stream knows + * what server to work with (via pendconn_dequeue() which sets it on + * strm->target). * * - a pendconn doesn't switch between queues, it stays where it is. */ @@ -557,49 +557,6 @@ int pendconn_redistribute(struct server *s) return xferred + px_xferred; } -/* Check for pending connections at the backend, and assign some of them to - * the server coming up. The server's weight is checked before being assigned - * connections it may not be able to handle. The total number of transferred - * connections is returned. It will take the proxy's queue lock and will not - * use nor depend on other locks. - */ -int pendconn_grab_from_px(struct server *s) -{ - struct pendconn *p; - int maxconn, xferred = 0; - - if (!srv_currently_usable(s)) - return 0; - - /* if this is a backup server and there are active servers or at - * least another backup server was elected, then this one must - * not dequeue requests from the proxy. - */ - if ((s->flags & SRV_F_BACKUP) && - (s->proxy->srv_act || - ((s != s->proxy->lbprm.fbck) && !(s->proxy->options & PR_O_USE_ALL_BK)))) - return 0; - - HA_SPIN_LOCK(QUEUE_LOCK, &s->proxy->queue.lock); - maxconn = srv_dynamic_maxconn(s); - while ((p = pendconn_first(&s->proxy->queue.head))) { - if (s->maxconn && s->served + xferred >= maxconn) - break; - - __pendconn_unlink_prx(p); - p->target = s; - - task_wakeup(p->strm->task, TASK_WOKEN_RES); - xferred++; - } - HA_SPIN_UNLOCK(QUEUE_LOCK, &s->proxy->queue.lock); - if (xferred) { - _HA_ATOMIC_SUB(&s->proxy->queue.length, xferred); - _HA_ATOMIC_SUB(&s->proxy->totpend, xferred); - } - return xferred; -} - /* Try to dequeue pending connection attached to the stream . It must * always exists here. If the pendconn is still linked to the server or the * proxy queue, nothing is done and the function returns 1. Otherwise, @@ -624,7 +581,7 @@ int pendconn_dequeue(struct stream *strm) p = strm->pend_pos; /* note below : we need to grab the queue's lock to check for emptiness - * because we don't want a partial _grab_from_px() or _redistribute() + * because we don't want a partial process_srv_queue() or redistribute() * to be called in parallel and show an empty list without having the * time to finish. With this we know that if we see the element * unlinked, these functions were completely done.