Commit 2d30c35b authored by Julian Anastasov's avatar Julian Anastasov Committed by David S. Miller

[IPVS]: Simplify ip_vs_wrr_gcd_weight

parent 5cf49e47
......@@ -58,26 +58,18 @@ static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)
{
struct ip_vs_dest *dest;
int weight;
int g = 1;
int g = 0;
list_for_each_entry(dest, &svc->destinations, n_list) {
weight = atomic_read(&dest->weight);
if (weight > 0) {
g = weight;
goto search_gcd;
if (g > 0)
g = gcd(weight, g);
else
g = weight;
}
}
return g;
search_gcd:
list_for_each_entry(dest, &svc->destinations, n_list) {
weight = atomic_read(&dest->weight);
if (weight > 0)
g = gcd(weight, g);
}
return g;
return g ? g : 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment