]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[SCSI] zfcp: Send ELS ADISC from workqueue
authorChristof Schmitt <christof.schmitt@de.ibm.com>
Mon, 2 Mar 2009 12:09:01 +0000 (13:09 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 12 Mar 2009 17:58:19 +0000 (12:58 -0500)
Issue ELS ADISC requests from workqueue. This allows the link test
request to be sent when the request queue is full due to I/O load for
other remote ports. It also simplifies request queue locking,
zfcp_fsf_send_fcp_command_task is now the only function that has
interrupts disabled from the caller. This is also a prereq for the FC
passthrough support that issues ELS requests from userspace.

Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_fc.c
drivers/s390/scsi/zfcp_fsf.c

index 969a3f0930377364cb6e1eb5015624bc97eb5e88..1e16ab58b242e3b8bf68d76580375bc571b00d26 100644 (file)
@@ -604,6 +604,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
        init_waitqueue_head(&port->remove_wq);
        INIT_LIST_HEAD(&port->unit_list_head);
        INIT_WORK(&port->gid_pn_work, zfcp_erp_port_strategy_open_lookup);
+       INIT_WORK(&port->test_link_work, zfcp_fc_link_test_work);
 
        port->adapter = adapter;
        port->d_id = d_id;
index ff15f11923e90f3dcf59eb27a4bc6e7c736434e4..8412bb992ea134afec8f917ccc723932c91e98aa 100644 (file)
@@ -513,6 +513,7 @@ struct zfcp_port {
        u32                    maxframe_size;
        u32                    supported_classes;
        struct work_struct     gid_pn_work;
+       struct work_struct     test_link_work;
 };
 
 struct zfcp_unit {
index 799ce1db1f5648f425efed41ecc40a471a3eed0d..a2b4987ac652546a5f20a2139ff823e39ccf8dc7 100644 (file)
@@ -101,6 +101,7 @@ extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *);
 extern int zfcp_fc_ns_gid_pn(struct zfcp_erp_action *);
 extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
 extern void zfcp_test_link(struct zfcp_port *);
+extern void zfcp_fc_link_test_work(struct work_struct *);
 extern void zfcp_fc_nameserver_init(struct zfcp_adapter *);
 
 /* zfcp_fsf.c */
index 67e6b7177870ffb5d77e4035ce7a2eb3a48f240e..0f435ed9d1a0091432c2e30e4fdab5e110730216 100644 (file)
@@ -421,19 +421,12 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
        return zfcp_fsf_send_els(&adisc->els);
 }
 
-/**
- * zfcp_test_link - lightweight link test procedure
- * @port: port to be tested
- *
- * Test status of a link to a remote port using the ELS command ADISC.
- * If there is a problem with the remote port, error recovery steps
- * will be triggered.
- */
-void zfcp_test_link(struct zfcp_port *port)
+void zfcp_fc_link_test_work(struct work_struct *work)
 {
+       struct zfcp_port *port =
+               container_of(work, struct zfcp_port, test_link_work);
        int retval;
 
-       zfcp_port_get(port);
        retval = zfcp_fc_adisc(port);
        if (retval == 0)
                return;
@@ -444,6 +437,21 @@ void zfcp_test_link(struct zfcp_port *port)
                zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
 }
 
+/**
+ * zfcp_test_link - lightweight link test procedure
+ * @port: port to be tested
+ *
+ * Test status of a link to a remote port using the ELS command ADISC.
+ * If there is a problem with the remote port, error recovery steps
+ * will be triggered.
+ */
+void zfcp_test_link(struct zfcp_port *port)
+{
+       zfcp_port_get(port);
+       if (!queue_work(zfcp_data.work_queue, &port->test_link_work))
+               zfcp_port_put(port);
+}
+
 static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num)
 {
        struct scatterlist *sg = &gpn_ft->sg_req;
index cc69db3b71e76eab0ee8109f5cddf403fd1c63da..9c3f91a343f3a2f6daea6fb29dfa64124fb485ee 100644 (file)
@@ -647,14 +647,6 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
        }
 }
 
-static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
-{
-       if (atomic_read(&adapter->req_q.count) > 0)
-               return 1;
-       atomic_inc(&adapter->qdio_outb_full);
-       return 0;
-}
-
 static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
        __releases(&adapter->req_q_lock)
        __acquires(&adapter->req_q_lock)
@@ -1177,8 +1169,8 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
                       ZFCP_STATUS_COMMON_UNBLOCKED)))
                return -EBUSY;
 
-       spin_lock(&adapter->req_q_lock);
-       if (!zfcp_fsf_sbal_available(adapter))
+       spin_lock_bh(&adapter->req_q_lock);
+       if (zfcp_fsf_req_sbal_get(adapter))
                goto out;
        req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
                                  ZFCP_REQ_AUTO_CLEANUP, NULL);
@@ -1211,7 +1203,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
 failed_send:
        zfcp_fsf_req_free(req);
 out:
-       spin_unlock(&adapter->req_q_lock);
+       spin_unlock_bh(&adapter->req_q_lock);
        return ret;
 }
 
@@ -2324,8 +2316,10 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
                return -EBUSY;
 
        spin_lock(&adapter->req_q_lock);
-       if (!zfcp_fsf_sbal_available(adapter))
+       if (atomic_read(&adapter->req_q.count) <= 0) {
+               atomic_inc(&adapter->qdio_outb_full);
                goto out;
+       }
        req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND,
                                  ZFCP_REQ_AUTO_CLEANUP,
                                  adapter->pool.fsf_req_scsi);