aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-06-17 23:37:30 -0400
committerRoland Dreier <rolandd@cisco.com>2006-06-17 23:37:30 -0400
commitb3589fd49067bab9fe0c60430860e6befbd5ba37 (patch)
treebe054dba4fd5d39e4af03d18e1d57d3b88033ca7 /drivers
parent549c5fc2c8149498118f2494a1b6a4938ca05985 (diff)
IB/srp: Change target_mutex to a spinlock
The SRP driver never sleeps while holding target_mutex, and it's just used to protect some simple list operations, so hold times will be short. So just convert it to a spinlock, which is smaller and faster. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c14
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 7c0a3d9c9056..ae1ab6acf460 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -361,9 +361,9 @@ static void srp_remove_work(void *target_ptr)
361 target->state = SRP_TARGET_REMOVED; 361 target->state = SRP_TARGET_REMOVED;
362 spin_unlock_irq(target->scsi_host->host_lock); 362 spin_unlock_irq(target->scsi_host->host_lock);
363 363
364 mutex_lock(&target->srp_host->target_mutex); 364 spin_lock(&target->srp_host->target_lock);
365 list_del(&target->list); 365 list_del(&target->list);
366 mutex_unlock(&target->srp_host->target_mutex); 366 spin_unlock(&target->srp_host->target_lock);
367 367
368 scsi_remove_host(target->scsi_host); 368 scsi_remove_host(target->scsi_host);
369 ib_destroy_cm_id(target->cm_id); 369 ib_destroy_cm_id(target->cm_id);
@@ -1450,9 +1450,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
1450 if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device)) 1450 if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device))
1451 return -ENODEV; 1451 return -ENODEV;
1452 1452
1453 mutex_lock(&host->target_mutex); 1453 spin_lock(&host->target_lock);
1454 list_add_tail(&target->list, &host->target_list); 1454 list_add_tail(&target->list, &host->target_list);
1455 mutex_unlock(&host->target_mutex); 1455 spin_unlock(&host->target_lock);
1456 1456
1457 target->state = SRP_TARGET_LIVE; 1457 target->state = SRP_TARGET_LIVE;
1458 1458
@@ -1724,7 +1724,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
1724 return NULL; 1724 return NULL;
1725 1725
1726 INIT_LIST_HEAD(&host->target_list); 1726 INIT_LIST_HEAD(&host->target_list);
1727 mutex_init(&host->target_mutex); 1727 spin_lock_init(&host->target_lock);
1728 init_completion(&host->released); 1728 init_completion(&host->released);
1729 host->dev = device; 1729 host->dev = device;
1730 host->port = port; 1730 host->port = port;
@@ -1866,14 +1866,14 @@ static void srp_remove_one(struct ib_device *device)
1866 * Mark all target ports as removed, so we stop queueing 1866 * Mark all target ports as removed, so we stop queueing
1867 * commands and don't try to reconnect. 1867 * commands and don't try to reconnect.
1868 */ 1868 */
1869 mutex_lock(&host->target_mutex); 1869 spin_lock(&host->target_lock);
1870 list_for_each_entry(target, &host->target_list, list) { 1870 list_for_each_entry(target, &host->target_list, list) {
1871 spin_lock_irqsave(target->scsi_host->host_lock, flags); 1871 spin_lock_irqsave(target->scsi_host->host_lock, flags);
1872 if (target->state != SRP_TARGET_REMOVED) 1872 if (target->state != SRP_TARGET_REMOVED)
1873 target->state = SRP_TARGET_REMOVED; 1873 target->state = SRP_TARGET_REMOVED;
1874 spin_unlock_irqrestore(target->scsi_host->host_lock, flags); 1874 spin_unlock_irqrestore(target->scsi_host->host_lock, flags);
1875 } 1875 }
1876 mutex_unlock(&host->target_mutex); 1876 spin_unlock(&host->target_lock);
1877 1877
1878 /* 1878 /*
1879 * Wait for any reconnection tasks that may have 1879 * Wait for any reconnection tasks that may have
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index 5ecda4ad8906..c071c3032700 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -99,7 +99,7 @@ struct srp_host {
99 u8 port; 99 u8 port;
100 struct class_device class_dev; 100 struct class_device class_dev;
101 struct list_head target_list; 101 struct list_head target_list;
102 struct mutex target_mutex; 102 spinlock_t target_lock;
103 struct completion released; 103 struct completion released;
104 struct list_head list; 104 struct list_head list;
105}; 105};