# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1355 -> 1.1356 # net/ipv4/ipvs/ip_vs_wlc.c 1.2 -> 1.3 # net/ipv4/ipvs/ip_vs_lblcr.c 1.5 -> 1.6 # net/ipv4/ipvs/ip_vs_lblc.c 1.4 -> 1.5 # net/ipv4/ipvs/ip_vs_lc.c 1.2 -> 1.3 # net/ipv4/ipvs/ip_vs_sed.c 1.2 -> 1.3 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/27 ja@xxxxxx 1.1356 # [IPV4/IPVS] Use list_for_each_entry_continue in some schedulers # -------------------------------------------- # diff -Nru a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c --- a/net/ipv4/ipvs/ip_vs_lblc.c Sat Sep 27 13:51:15 2003 +++ b/net/ipv4/ipvs/ip_vs_lblc.c Sat Sep 27 13:51:15 2003 @@ -458,10 +458,11 @@ * The server with weight=0 is quiesced and will not receive any * new connection. */ - list_for_each_entry(least, &svc->destinations, n_list) { - if (least->flags & IP_VS_DEST_F_OVERLOAD) + list_for_each_entry(dest, &svc->destinations, n_list) { + if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; - if (atomic_read(&least->weight) > 0) { + if (atomic_read(&dest->weight) > 0) { + least = dest; loh = atomic_read(&least->activeconns) * 50 + atomic_read(&least->inactconns); goto nextstage; @@ -473,7 +474,7 @@ * Find the destination with the least load. */ nextstage: - list_for_each_entry(dest, &svc->destinations, n_list) { + list_for_each_entry_continue(dest, &svc->destinations, n_list) { if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; diff -Nru a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c --- a/net/ipv4/ipvs/ip_vs_lblcr.c Sat Sep 27 13:51:15 2003 +++ b/net/ipv4/ipvs/ip_vs_lblcr.c Sat Sep 27 13:51:15 2003 @@ -711,11 +711,12 @@ * The server with weight=0 is quiesced and will not receive any * new connection. */ - list_for_each_entry(least, &svc->destinations, n_list) { - if (least->flags & IP_VS_DEST_F_OVERLOAD) + list_for_each_entry(dest, &svc->destinations, n_list) { + if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; - if (atomic_read(&least->weight) > 0) { + if (atomic_read(&dest->weight) > 0) { + least = dest; loh = atomic_read(&least->activeconns) * 50 + atomic_read(&least->inactconns); goto nextstage; @@ -727,7 +728,7 @@ * Find the destination with the least load. */ nextstage: - list_for_each_entry(dest, &svc->destinations, n_list) { + list_for_each_entry_continue(dest, &svc->destinations, n_list) { if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; diff -Nru a/net/ipv4/ipvs/ip_vs_lc.c b/net/ipv4/ipvs/ip_vs_lc.c --- a/net/ipv4/ipvs/ip_vs_lc.c Sat Sep 27 13:51:15 2003 +++ b/net/ipv4/ipvs/ip_vs_lc.c Sat Sep 27 13:51:15 2003 @@ -65,8 +65,8 @@ static struct ip_vs_dest * ip_vs_lc_schedule(struct ip_vs_service *svc, struct iphdr *iph) { - struct ip_vs_dest *dest, *least; - unsigned int loh, doh; + struct ip_vs_dest *dest, *least = NULL; + unsigned int loh = 0, doh; IP_VS_DBG(6, "ip_vs_lc_schedule(): Scheduling...\n"); @@ -79,31 +79,18 @@ * served, but no new connection is assigned to the server. */ - list_for_each_entry(least, &svc->destinations, n_list) { - if (least->flags & IP_VS_DEST_F_OVERLOAD) - continue; - if (atomic_read(&least->weight) > 0) { - loh = ip_vs_lc_dest_overhead(least); - goto nextstage; - } - } - return NULL; - - /* - * Find the destination with the least load. - */ - nextstage: list_for_each_entry(dest, &svc->destinations, n_list) { if ((dest->flags & IP_VS_DEST_F_OVERLOAD) || atomic_read(&dest->weight) == 0) continue; doh = ip_vs_lc_dest_overhead(dest); - if (doh < loh) { + if (!least || doh < loh) { least = dest; loh = doh; } } + if (least) IP_VS_DBG(6, "LC: server %u.%u.%u.%u:%u activeconns %d inactconns %d\n", NIPQUAD(least->addr), ntohs(least->port), atomic_read(&least->activeconns), diff -Nru a/net/ipv4/ipvs/ip_vs_sed.c b/net/ipv4/ipvs/ip_vs_sed.c --- a/net/ipv4/ipvs/ip_vs_sed.c Sat Sep 27 13:51:15 2003 +++ b/net/ipv4/ipvs/ip_vs_sed.c Sat Sep 27 13:51:15 2003 @@ -103,9 +103,10 @@ * new connections. */ - list_for_each_entry(least, &svc->destinations, n_list) { - if (!(least->flags & IP_VS_DEST_F_OVERLOAD) && - atomic_read(&least->weight) > 0) { + list_for_each_entry(dest, &svc->destinations, n_list) { + if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) && + atomic_read(&dest->weight) > 0) { + least = dest; loh = ip_vs_sed_dest_overhead(least); goto nextstage; } @@ -116,7 +117,7 @@ * Find the destination with the least load. */ nextstage: - list_for_each_entry(dest, &svc->destinations, n_list) { + list_for_each_entry_continue(dest, &svc->destinations, n_list) { if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; doh = ip_vs_sed_dest_overhead(dest); diff -Nru a/net/ipv4/ipvs/ip_vs_wlc.c b/net/ipv4/ipvs/ip_vs_wlc.c --- a/net/ipv4/ipvs/ip_vs_wlc.c Sat Sep 27 13:51:15 2003 +++ b/net/ipv4/ipvs/ip_vs_wlc.c Sat Sep 27 13:51:15 2003 @@ -91,9 +91,10 @@ * new connections. */ - list_for_each_entry(least, &svc->destinations, n_list) { - if (!(least->flags & IP_VS_DEST_F_OVERLOAD) && - atomic_read(&least->weight) > 0) { + list_for_each_entry(dest, &svc->destinations, n_list) { + if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) && + atomic_read(&dest->weight) > 0) { + least = dest; loh = ip_vs_wlc_dest_overhead(least); goto nextstage; } @@ -104,7 +105,7 @@ * Find the destination with the least load. */ nextstage: - list_for_each_entry(dest, &svc->destinations, n_list) { + list_for_each_entry_continue(dest, &svc->destinations, n_list) { if (dest->flags & IP_VS_DEST_F_OVERLOAD) continue; doh = ip_vs_wlc_dest_overhead(dest);