bonding: convert curr_slave_lock to a spinlock and rename it
authorNikolay Aleksandrov <nikolay@redhat.com>
Thu, 11 Sep 2014 20:49:25 +0000 (22:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Sep 2014 20:29:07 +0000 (16:29 -0400)
curr_slave_lock is now a misleading name, a much better name is
mode_lock as it'll be used for each mode's purposes and it's no longer
necessary to use a rwlock, a simple spinlock is enough.

Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_main.c
drivers/net/bonding/bonding.h

index dfd3a7835d17bf5634f1578c380e7b27046dceb1..1824d1df4d09ca7001b3d3908c88507b54305e78 100644 (file)
@@ -2057,7 +2057,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
        struct port *port;
        bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
 
-       read_lock(&bond->curr_slave_lock);
+       spin_lock_bh(&bond->mode_lock);
        rcu_read_lock();
 
        /* check if there are any slaves */
@@ -2120,7 +2120,7 @@ re_arm:
                }
        }
        rcu_read_unlock();
-       read_unlock(&bond->curr_slave_lock);
+       spin_unlock_bh(&bond->mode_lock);
 
        if (should_notify_rtnl && rtnl_trylock()) {
                bond_slave_state_notify(bond);
index 3b06685260b844b439e9c13258a418e433ef8a69..99d21c2fd44fad4e54269dd3dc8a81dfd6dc02bc 100644 (file)
@@ -1679,9 +1679,9 @@ static int __bond_release_one(struct net_device *bond_dev,
                /* Sync against bond_3ad_rx_indication and
                 * bond_3ad_state_machine_handler
                 */
-               write_lock_bh(&bond->curr_slave_lock);
+               spin_lock_bh(&bond->mode_lock);
                bond_3ad_unbind_slave(slave);
-               write_unlock_bh(&bond->curr_slave_lock);
+               spin_unlock_bh(&bond->mode_lock);
        }
 
        netdev_info(bond_dev, "Releasing %s interface %s\n",
@@ -3850,8 +3850,7 @@ void bond_setup(struct net_device *bond_dev)
 {
        struct bonding *bond = netdev_priv(bond_dev);
 
-       /* initialize rwlocks */
-       rwlock_init(&bond->curr_slave_lock);
+       spin_lock_init(&bond->mode_lock);
        bond->params = bonding_defaults;
 
        /* Initialize pointers */
index 02afdeb0876528af4ee473fb05043e75981862b9..0cda34b827f81002facfc5807a13ff79158ae84a 100644 (file)
@@ -195,7 +195,7 @@ struct bonding {
        s32      slave_cnt; /* never change this value outside the attach/detach wrappers */
        int     (*recv_probe)(const struct sk_buff *, struct bonding *,
                              struct slave *);
-       rwlock_t curr_slave_lock;
+       spinlock_t mode_lock;
        u8       send_peer_notif;
        u8       igmp_retrans;
 #ifdef CONFIG_PROC_FS