[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1410435523-7520-5-git-send-email-nikolay@redhat.com>
Date: Thu, 11 Sep 2014 13:38:40 +0200
From: Nikolay Aleksandrov <nikolay@...hat.com>
To: netdev@...r.kernel.org
Cc: vfalico@...il.com, j.vosburgh@...il.com, andy@...yhouse.net,
davem@...emloft.net, Nikolay Aleksandrov <nikolay@...hat.com>
Subject: [PATCH net-next 4/7] bonding: convert curr_slave_lock to a spinlock and rename it
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@...onical.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@...hat.com>
---
drivers/net/bonding/bond_3ad.c | 4 ++--
drivers/net/bonding/bond_main.c | 7 +++----
drivers/net/bonding/bonding.h | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 6512c1cee666..1b19f35689a4 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2077,10 +2077,10 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
goto re_arm;
}
- read_lock(&bond->curr_slave_lock);
+ spin_lock_bh(&bond->mode_lock);
aggregator = __get_first_agg(port);
ad_agg_selection_logic(aggregator);
- read_unlock(&bond->curr_slave_lock);
+ spin_unlock_bh(&bond->mode_lock);
}
bond_3ad_set_carrier(bond);
}
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3b06685260b8..99d21c2fd44f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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 */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 02afdeb08765..0cda34b827f8 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -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
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists