mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-01 11:01:46 +00:00
MINOR: lb/api: remove the locked argument from take_conn/drop_conn
This essentially reverts commit 2b4370078 ("MINOR: lb/api: let callers of take_conn/drop_conn tell if they have the lock") that was merged during 2.4 before the various locks could be eliminated at the lower layers. Passing that information complicates the cleanup of the queuing code and it's become useless.
This commit is contained in:
parent
1b648c857b
commit
5941ef0a6c
@ -162,13 +162,13 @@ struct lbprm {
|
||||
|
||||
/* Call backs for some actions. Any of them may be NULL (thus should be ignored).
|
||||
* Those marked "srvlock" will need to be called with the server lock held.
|
||||
* The other ones might take it themselves if needed, based on indications.
|
||||
* The other ones might take it themselves if needed.
|
||||
*/
|
||||
void (*update_server_eweight)(struct server *); /* to be called after eweight change // srvlock */
|
||||
void (*set_server_status_up)(struct server *); /* to be called after status changes to UP // srvlock */
|
||||
void (*set_server_status_down)(struct server *); /* to be called after status changes to DOWN // srvlock */
|
||||
void (*server_take_conn)(struct server *, int locked); /* to be called when connection is assigned */
|
||||
void (*server_drop_conn)(struct server *, int locked); /* to be called when connection is dropped */
|
||||
void (*server_take_conn)(struct server *); /* to be called when connection is assigned */
|
||||
void (*server_drop_conn)(struct server *); /* to be called when connection is dropped */
|
||||
};
|
||||
|
||||
#endif /* _HAPROXY_BACKEND_T_H */
|
||||
|
@ -1702,7 +1702,7 @@ skip_reuse:
|
||||
count = _HA_ATOMIC_ADD_FETCH(&srv->cur_sess, 1);
|
||||
HA_ATOMIC_UPDATE_MAX(&srv->counters.cur_sess_max, count);
|
||||
if (s->be->lbprm.server_take_conn)
|
||||
s->be->lbprm.server_take_conn(srv, 0);
|
||||
s->be->lbprm.server_take_conn(srv);
|
||||
}
|
||||
|
||||
/* Now handle synchronously connected sockets. We know the stream-int
|
||||
|
@ -60,11 +60,9 @@ static inline void fas_queue_srv(struct server *s)
|
||||
/* Re-position the server in the FS tree after it has been assigned one
|
||||
* connection or after it has released one. Note that it is possible that
|
||||
* the server has been moved out of the tree due to failed health-checks.
|
||||
*
|
||||
* <locked> must reflect the server's lock ownership. The lbprm's lock will
|
||||
* be used.
|
||||
* The lbprm's lock will be used.
|
||||
*/
|
||||
static void fas_srv_reposition(struct server *s, int locked)
|
||||
static void fas_srv_reposition(struct server *s)
|
||||
{
|
||||
HA_RWLOCK_WRLOCK(LBPRM_LOCK, &s->proxy->lbprm.lock);
|
||||
if (s->lb_tree) {
|
||||
|
@ -66,11 +66,9 @@ static inline void fwlc_queue_srv(struct server *s, unsigned int eweight)
|
||||
/* Re-position the server in the FWLC tree after it has been assigned one
|
||||
* connection or after it has released one. Note that it is possible that
|
||||
* the server has been moved out of the tree due to failed health-checks.
|
||||
*
|
||||
* <locked> must reflect the server's lock ownership. The lbprm's lock will
|
||||
* be used.
|
||||
* The lbprm's lock will be used.
|
||||
*/
|
||||
static void fwlc_srv_reposition(struct server *s, int locked)
|
||||
static void fwlc_srv_reposition(struct server *s)
|
||||
{
|
||||
unsigned int inflight = _HA_ATOMIC_LOAD(&s->served) + _HA_ATOMIC_LOAD(&s->nbpend);
|
||||
unsigned int new_key = inflight ? (inflight + 1) * SRV_EWGHT_MAX / s->cur_eweight : 0;
|
||||
|
@ -367,7 +367,7 @@ void process_srv_queue(struct server *s, int server_locked)
|
||||
_HA_ATOMIC_ADD(&p->served, done);
|
||||
|
||||
if (done && p->lbprm.server_take_conn)
|
||||
p->lbprm.server_take_conn(s, server_locked);
|
||||
p->lbprm.server_take_conn(s);
|
||||
}
|
||||
|
||||
/* Adds the stream <strm> to the pending connection queue of server <strm>->srv
|
||||
|
@ -2619,7 +2619,7 @@ void sess_change_server(struct stream *strm, struct server *newsrv)
|
||||
_HA_ATOMIC_DEC(&oldsrv->proxy->served);
|
||||
__ha_barrier_atomic_store();
|
||||
if (oldsrv->proxy->lbprm.server_drop_conn)
|
||||
oldsrv->proxy->lbprm.server_drop_conn(oldsrv, 0);
|
||||
oldsrv->proxy->lbprm.server_drop_conn(oldsrv);
|
||||
stream_del_srv_conn(strm);
|
||||
}
|
||||
|
||||
@ -2628,7 +2628,7 @@ void sess_change_server(struct stream *strm, struct server *newsrv)
|
||||
_HA_ATOMIC_INC(&newsrv->proxy->served);
|
||||
__ha_barrier_atomic_store();
|
||||
if (newsrv->proxy->lbprm.server_take_conn)
|
||||
newsrv->proxy->lbprm.server_take_conn(newsrv, 0);
|
||||
newsrv->proxy->lbprm.server_take_conn(newsrv);
|
||||
stream_add_srv_conn(strm, newsrv);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user