bonding: rework bond_find_best_slave() to use bond_for_each_slave()
authorVeaceslav Falico <vfalico@redhat.com>
Wed, 25 Sep 2013 07:20:18 +0000 (09:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Sep 2013 20:02:05 +0000 (16:02 -0400)
commit77140d2951432487d012dbcdcf124168eafc49ca
tree83ace6a8c59e8ff3ebf0b3d5906f215c284401cc
parent6475ae4ceea2f430db1daabf6460a9f36bc97438
bonding: rework bond_find_best_slave() to use bond_for_each_slave()

bond_find_best_slave() does not have to be balanced - i.e. return the slave
that is *after* some other slave, but rather return the best slave that
suits, except of bond->primary_slave - in which case we just return it if
it's suitable.

After that we just look through all the slaves and return either first up
slave or the slave whose link came back earliest.

We also don't care about curr_active_slave lock cause we use it in
bond_should_change_active() only and there we take it right away - i.e. it
won't go away.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c