aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-02-17 05:18:49 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-17 18:46:17 -0500
commite60a6d69f1f84c2ef1cc63aefaadfe7ae9f12934 (patch)
tree82d93610abd9c859eb43675b095583b17253309d /drivers
parentcae727db30e9bcbc0256ec3282edce98b4a85433 (diff)
[SCSI] zfcp: Remove function zfcp_reqlist_find_safe
Always use the FSF request id as a reference to the FSF request. With this change the function zfcp_reqlist_find_safe is no longer needed and can be removed. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c2
-rw-r--r--drivers/s390/scsi/zfcp_def.h17
-rw-r--r--drivers/s390/scsi/zfcp_erp.c17
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c34
4 files changed, 29 insertions, 41 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 7369c8911bc..818b6ad935a 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
668 r->u.action.action = (unsigned long)erp_action; 668 r->u.action.action = (unsigned long)erp_action;
669 r->u.action.status = erp_action->status; 669 r->u.action.status = erp_action->status;
670 r->u.action.step = erp_action->step; 670 r->u.action.step = erp_action->step;
671 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; 671 r->u.action.fsf_req = erp_action->fsf_req_id;
672 debug_event(dbf->rec, 5, r, sizeof(*r)); 672 debug_event(dbf->rec, 5, r, sizeof(*r));
673 spin_unlock_irqrestore(&dbf->rec_lock, flags); 673 spin_unlock_irqrestore(&dbf->rec_lock, flags);
674} 674}
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e1b5b88e2dd..6ed48654c29 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -143,8 +143,7 @@ struct zfcp_erp_action {
143 struct zfcp_unit *unit; 143 struct zfcp_unit *unit;
144 u32 status; /* recovery status */ 144 u32 status; /* recovery status */
145 u32 step; /* active step of this erp action */ 145 u32 step; /* active step of this erp action */
146 struct zfcp_fsf_req *fsf_req; /* fsf request currently pending 146 unsigned long fsf_req_id;
147 for this action */
148 struct timer_list timer; 147 struct timer_list timer;
149}; 148};
150 149
@@ -379,18 +378,4 @@ zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
379 return NULL; 378 return NULL;
380} 379}
381 380
382static inline struct zfcp_fsf_req *
383zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
384{
385 struct zfcp_fsf_req *request;
386 unsigned int idx;
387
388 for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) {
389 list_for_each_entry(request, &adapter->req_list[idx], list)
390 if (request == req)
391 return request;
392 }
393 return NULL;
394}
395
396#endif /* ZFCP_DEF_H */ 381#endif /* ZFCP_DEF_H */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index b51a11a82e6..d40d5b0f263 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -478,25 +478,26 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
478static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) 478static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
479{ 479{
480 struct zfcp_adapter *adapter = act->adapter; 480 struct zfcp_adapter *adapter = act->adapter;
481 struct zfcp_fsf_req *req;
481 482
482 if (!act->fsf_req) 483 if (!act->fsf_req_id)
483 return; 484 return;
484 485
485 spin_lock(&adapter->req_list_lock); 486 spin_lock(&adapter->req_list_lock);
486 if (zfcp_reqlist_find_safe(adapter, act->fsf_req) && 487 req = zfcp_reqlist_find(adapter, act->fsf_req_id);
487 act->fsf_req->erp_action == act) { 488 if (req && req->erp_action == act) {
488 if (act->status & (ZFCP_STATUS_ERP_DISMISSED | 489 if (act->status & (ZFCP_STATUS_ERP_DISMISSED |
489 ZFCP_STATUS_ERP_TIMEDOUT)) { 490 ZFCP_STATUS_ERP_TIMEDOUT)) {
490 act->fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; 491 req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
491 zfcp_dbf_rec_action("erscf_1", act); 492 zfcp_dbf_rec_action("erscf_1", act);
492 act->fsf_req->erp_action = NULL; 493 req->erp_action = NULL;
493 } 494 }
494 if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) 495 if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
495 zfcp_dbf_rec_action("erscf_2", act); 496 zfcp_dbf_rec_action("erscf_2", act);
496 if (act->fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) 497 if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
497 act->fsf_req = NULL; 498 act->fsf_req_id = 0;
498 } else 499 } else
499 act->fsf_req = NULL; 500 act->fsf_req_id = 0;
500 spin_unlock(&adapter->req_list_lock); 501 spin_unlock(&adapter->req_list_lock);
501} 502}
502 503
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index e8fb4d9baa8..fd2371b6948 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -773,10 +773,11 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
773 unsigned long flags; 773 unsigned long flags;
774 int idx; 774 int idx;
775 int with_qtcb = (req->qtcb != NULL); 775 int with_qtcb = (req->qtcb != NULL);
776 int req_id = req->req_id;
776 777
777 /* put allocated FSF request into hash table */ 778 /* put allocated FSF request into hash table */
778 spin_lock_irqsave(&adapter->req_list_lock, flags); 779 spin_lock_irqsave(&adapter->req_list_lock, flags);
779 idx = zfcp_reqlist_hash(req->req_id); 780 idx = zfcp_reqlist_hash(req_id);
780 list_add_tail(&req->list, &adapter->req_list[idx]); 781 list_add_tail(&req->list, &adapter->req_list[idx]);
781 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 782 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
782 783
@@ -786,7 +787,8 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
786 del_timer(&req->timer); 787 del_timer(&req->timer);
787 spin_lock_irqsave(&adapter->req_list_lock, flags); 788 spin_lock_irqsave(&adapter->req_list_lock, flags);
788 /* lookup request again, list might have changed */ 789 /* lookup request again, list might have changed */
789 if (zfcp_reqlist_find_safe(adapter, req)) 790 req = zfcp_reqlist_find(adapter, req_id);
791 if (req)
790 zfcp_reqlist_remove(adapter, req); 792 zfcp_reqlist_remove(adapter, req);
791 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 793 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
792 zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); 794 zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req);
@@ -1262,13 +1264,13 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1262 FSF_FEATURE_UPDATE_ALERT; 1264 FSF_FEATURE_UPDATE_ALERT;
1263 req->erp_action = erp_action; 1265 req->erp_action = erp_action;
1264 req->handler = zfcp_fsf_exchange_config_data_handler; 1266 req->handler = zfcp_fsf_exchange_config_data_handler;
1265 erp_action->fsf_req = req; 1267 erp_action->fsf_req_id = req->req_id;
1266 1268
1267 zfcp_fsf_start_erp_timer(req); 1269 zfcp_fsf_start_erp_timer(req);
1268 retval = zfcp_fsf_req_send(req); 1270 retval = zfcp_fsf_req_send(req);
1269 if (retval) { 1271 if (retval) {
1270 zfcp_fsf_req_free(req); 1272 zfcp_fsf_req_free(req);
1271 erp_action->fsf_req = NULL; 1273 erp_action->fsf_req_id = 0;
1272 } 1274 }
1273out: 1275out:
1274 spin_unlock_bh(&qdio->req_q_lock); 1276 spin_unlock_bh(&qdio->req_q_lock);
@@ -1355,13 +1357,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1355 1357
1356 req->handler = zfcp_fsf_exchange_port_data_handler; 1358 req->handler = zfcp_fsf_exchange_port_data_handler;
1357 req->erp_action = erp_action; 1359 req->erp_action = erp_action;
1358 erp_action->fsf_req = req; 1360 erp_action->fsf_req_id = req->req_id;
1359 1361
1360 zfcp_fsf_start_erp_timer(req); 1362 zfcp_fsf_start_erp_timer(req);
1361 retval = zfcp_fsf_req_send(req); 1363 retval = zfcp_fsf_req_send(req);
1362 if (retval) { 1364 if (retval) {
1363 zfcp_fsf_req_free(req); 1365 zfcp_fsf_req_free(req);
1364 erp_action->fsf_req = NULL; 1366 erp_action->fsf_req_id = 0;
1365 } 1367 }
1366out: 1368out:
1367 spin_unlock_bh(&qdio->req_q_lock); 1369 spin_unlock_bh(&qdio->req_q_lock);
@@ -1521,14 +1523,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1521 hton24(req->qtcb->bottom.support.d_id, port->d_id); 1523 hton24(req->qtcb->bottom.support.d_id, port->d_id);
1522 req->data = port; 1524 req->data = port;
1523 req->erp_action = erp_action; 1525 req->erp_action = erp_action;
1524 erp_action->fsf_req = req; 1526 erp_action->fsf_req_id = req->req_id;
1525 get_device(&port->sysfs_device); 1527 get_device(&port->sysfs_device);
1526 1528
1527 zfcp_fsf_start_erp_timer(req); 1529 zfcp_fsf_start_erp_timer(req);
1528 retval = zfcp_fsf_req_send(req); 1530 retval = zfcp_fsf_req_send(req);
1529 if (retval) { 1531 if (retval) {
1530 zfcp_fsf_req_free(req); 1532 zfcp_fsf_req_free(req);
1531 erp_action->fsf_req = NULL; 1533 erp_action->fsf_req_id = 0;
1532 put_device(&port->sysfs_device); 1534 put_device(&port->sysfs_device);
1533 } 1535 }
1534out: 1536out:
@@ -1591,13 +1593,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1591 req->data = erp_action->port; 1593 req->data = erp_action->port;
1592 req->erp_action = erp_action; 1594 req->erp_action = erp_action;
1593 req->qtcb->header.port_handle = erp_action->port->handle; 1595 req->qtcb->header.port_handle = erp_action->port->handle;
1594 erp_action->fsf_req = req; 1596 erp_action->fsf_req_id = req->req_id;
1595 1597
1596 zfcp_fsf_start_erp_timer(req); 1598 zfcp_fsf_start_erp_timer(req);
1597 retval = zfcp_fsf_req_send(req); 1599 retval = zfcp_fsf_req_send(req);
1598 if (retval) { 1600 if (retval) {
1599 zfcp_fsf_req_free(req); 1601 zfcp_fsf_req_free(req);
1600 erp_action->fsf_req = NULL; 1602 erp_action->fsf_req_id = 0;
1601 } 1603 }
1602out: 1604out:
1603 spin_unlock_bh(&qdio->req_q_lock); 1605 spin_unlock_bh(&qdio->req_q_lock);
@@ -1817,13 +1819,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1817 req->qtcb->header.port_handle = erp_action->port->handle; 1819 req->qtcb->header.port_handle = erp_action->port->handle;
1818 req->erp_action = erp_action; 1820 req->erp_action = erp_action;
1819 req->handler = zfcp_fsf_close_physical_port_handler; 1821 req->handler = zfcp_fsf_close_physical_port_handler;
1820 erp_action->fsf_req = req; 1822 erp_action->fsf_req_id = req->req_id;
1821 1823
1822 zfcp_fsf_start_erp_timer(req); 1824 zfcp_fsf_start_erp_timer(req);
1823 retval = zfcp_fsf_req_send(req); 1825 retval = zfcp_fsf_req_send(req);
1824 if (retval) { 1826 if (retval) {
1825 zfcp_fsf_req_free(req); 1827 zfcp_fsf_req_free(req);
1826 erp_action->fsf_req = NULL; 1828 erp_action->fsf_req_id = 0;
1827 } 1829 }
1828out: 1830out:
1829 spin_unlock_bh(&qdio->req_q_lock); 1831 spin_unlock_bh(&qdio->req_q_lock);
@@ -1991,7 +1993,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1991 req->handler = zfcp_fsf_open_unit_handler; 1993 req->handler = zfcp_fsf_open_unit_handler;
1992 req->data = erp_action->unit; 1994 req->data = erp_action->unit;
1993 req->erp_action = erp_action; 1995 req->erp_action = erp_action;
1994 erp_action->fsf_req = req; 1996 erp_action->fsf_req_id = req->req_id;
1995 1997
1996 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) 1998 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
1997 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING; 1999 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING;
@@ -2000,7 +2002,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2000 retval = zfcp_fsf_req_send(req); 2002 retval = zfcp_fsf_req_send(req);
2001 if (retval) { 2003 if (retval) {
2002 zfcp_fsf_req_free(req); 2004 zfcp_fsf_req_free(req);
2003 erp_action->fsf_req = NULL; 2005 erp_action->fsf_req_id = 0;
2004 } 2006 }
2005out: 2007out:
2006 spin_unlock_bh(&qdio->req_q_lock); 2008 spin_unlock_bh(&qdio->req_q_lock);
@@ -2077,13 +2079,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2077 req->handler = zfcp_fsf_close_unit_handler; 2079 req->handler = zfcp_fsf_close_unit_handler;
2078 req->data = erp_action->unit; 2080 req->data = erp_action->unit;
2079 req->erp_action = erp_action; 2081 req->erp_action = erp_action;
2080 erp_action->fsf_req = req; 2082 erp_action->fsf_req_id = req->req_id;
2081 2083
2082 zfcp_fsf_start_erp_timer(req); 2084 zfcp_fsf_start_erp_timer(req);
2083 retval = zfcp_fsf_req_send(req); 2085 retval = zfcp_fsf_req_send(req);
2084 if (retval) { 2086 if (retval) {
2085 zfcp_fsf_req_free(req); 2087 zfcp_fsf_req_free(req);
2086 erp_action->fsf_req = NULL; 2088 erp_action->fsf_req_id = 0;
2087 } 2089 }
2088out: 2090out:
2089 spin_unlock_bh(&qdio->req_q_lock); 2091 spin_unlock_bh(&qdio->req_q_lock);