[SCSI] zfcp: Remove adapter list
authorChristof Schmitt <christof.schmitt@de.ibm.com>
Fri, 19 Dec 2008 15:56:55 +0000 (16:56 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 29 Dec 2008 17:24:36 +0000 (11:24 -0600)
After the latest changes, the list of FCP devices is only used to
lookup the adapter for requests from the actcli tool. Change this to
use the lookup function in the cio layer. Now we can remove the
adapter list and have one place less to use the global config_lock.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Acked-by: Felix Beck <felix@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_cfdc.c
drivers/s390/scsi/zfcp_def.h

index f0f49feaa34f0a6e3b205c15101b1509952a74de..d7d3148d15e2d63406b85262a42749061f8913f0 100644 (file)
@@ -181,7 +181,6 @@ static int __init zfcp_module_init(void)
 
        zfcp_data.work_queue = create_singlethread_workqueue("zfcp_wq");
 
-       INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
        sema_init(&zfcp_data.config_sema, 1);
        rwlock_init(&zfcp_data.config_lock);
 
@@ -527,11 +526,7 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
                               &zfcp_sysfs_adapter_attrs))
                goto sysfs_failed;
 
-       write_lock_irq(&zfcp_data.config_lock);
        atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
-       list_add_tail(&adapter->list, &zfcp_data.adapter_list_head);
-       write_unlock_irq(&zfcp_data.config_lock);
-
        zfcp_fc_nameserver_init(adapter);
 
        if (!zfcp_adapter_scsi_register(adapter))
@@ -574,14 +569,7 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
                return;
 
        zfcp_adapter_debug_unregister(adapter);
-
-       /* remove specified adapter data structure from list */
-       write_lock_irq(&zfcp_data.config_lock);
-       list_del(&adapter->list);
-       write_unlock_irq(&zfcp_data.config_lock);
-
        zfcp_qdio_free(adapter);
-
        zfcp_free_low_mem_buffers(adapter);
        kfree(adapter->req_list);
        kfree(adapter->fc_stats);
index f1a7518e67ed62025e74248e5d355a25aa138edc..10cbfd172a28fc2078b35dc3033a2ec1d77c1236 100644 (file)
@@ -85,20 +85,9 @@ static int zfcp_cfdc_copy_to_user(void __user  *user_buffer,
 
 static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno)
 {
-       struct zfcp_adapter *adapter = NULL, *cur_adapter;
-       struct ccw_dev_id dev_id;
-
-       read_lock_irq(&zfcp_data.config_lock);
-       list_for_each_entry(cur_adapter, &zfcp_data.adapter_list_head, list) {
-               ccw_device_get_id(cur_adapter->ccw_device, &dev_id);
-               if (dev_id.devno == devno) {
-                       adapter = cur_adapter;
-                       zfcp_adapter_get(adapter);
-                       break;
-               }
-       }
-       read_unlock_irq(&zfcp_data.config_lock);
-       return adapter;
+       char busid[9];
+       snprintf(busid, sizeof(busid), "0.0.%04x", devno);
+       return zfcp_get_adapter_by_busid(busid);
 }
 
 static int zfcp_cfdc_set_fsf(struct zfcp_fsf_cfdc *fsf_cfdc, int command)
index e19e46ae4a68a24b5803f2dc8ef9be994b6f99e5..b95e73ee0d6f028c11ae576abf3ad45f784793ce 100644 (file)
@@ -451,7 +451,6 @@ struct zfcp_latencies {
 };
 
 struct zfcp_adapter {
-       struct list_head        list;              /* list of adapters */
        atomic_t                refcount;          /* reference count */
        wait_queue_head_t       remove_wq;         /* can be used to wait for
                                                      refcount drop to zero */
@@ -593,7 +592,6 @@ struct zfcp_fsf_req {
 struct zfcp_data {
        struct scsi_host_template scsi_host_template;
        struct scsi_transport_template *scsi_transport_template;
-       struct list_head        adapter_list_head;  /* head of adapter list */
        rwlock_t                config_lock;        /* serialises changes
                                                       to adapter/port/unit
                                                       lists */