Commit e60a6d69 authored by Christof Schmitt's avatar Christof Schmitt Committed by James Bottomley

[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: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent cae727db
...@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action) ...@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
r->u.action.action = (unsigned long)erp_action; r->u.action.action = (unsigned long)erp_action;
r->u.action.status = erp_action->status; r->u.action.status = erp_action->status;
r->u.action.step = erp_action->step; r->u.action.step = erp_action->step;
r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; r->u.action.fsf_req = erp_action->fsf_req_id;
debug_event(dbf->rec, 5, r, sizeof(*r)); debug_event(dbf->rec, 5, r, sizeof(*r));
spin_unlock_irqrestore(&dbf->rec_lock, flags); spin_unlock_irqrestore(&dbf->rec_lock, flags);
} }
......
...@@ -143,8 +143,7 @@ struct zfcp_erp_action { ...@@ -143,8 +143,7 @@ struct zfcp_erp_action {
struct zfcp_unit *unit; struct zfcp_unit *unit;
u32 status; /* recovery status */ u32 status; /* recovery status */
u32 step; /* active step of this erp action */ u32 step; /* active step of this erp action */
struct zfcp_fsf_req *fsf_req; /* fsf request currently pending unsigned long fsf_req_id;
for this action */
struct timer_list timer; struct timer_list timer;
}; };
...@@ -379,18 +378,4 @@ zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id) ...@@ -379,18 +378,4 @@ zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
return NULL; return NULL;
} }
static inline struct zfcp_fsf_req *
zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
{
struct zfcp_fsf_req *request;
unsigned int idx;
for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) {
list_for_each_entry(request, &adapter->req_list[idx], list)
if (request == req)
return request;
}
return NULL;
}
#endif /* ZFCP_DEF_H */ #endif /* ZFCP_DEF_H */
...@@ -478,25 +478,26 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) ...@@ -478,25 +478,26 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
{ {
struct zfcp_adapter *adapter = act->adapter; struct zfcp_adapter *adapter = act->adapter;
struct zfcp_fsf_req *req;
if (!act->fsf_req) if (!act->fsf_req_id)
return; return;
spin_lock(&adapter->req_list_lock); spin_lock(&adapter->req_list_lock);
if (zfcp_reqlist_find_safe(adapter, act->fsf_req) && req = zfcp_reqlist_find(adapter, act->fsf_req_id);
act->fsf_req->erp_action == act) { if (req && req->erp_action == act) {
if (act->status & (ZFCP_STATUS_ERP_DISMISSED | if (act->status & (ZFCP_STATUS_ERP_DISMISSED |
ZFCP_STATUS_ERP_TIMEDOUT)) { ZFCP_STATUS_ERP_TIMEDOUT)) {
act->fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
zfcp_dbf_rec_action("erscf_1", act); zfcp_dbf_rec_action("erscf_1", act);
act->fsf_req->erp_action = NULL; req->erp_action = NULL;
} }
if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
zfcp_dbf_rec_action("erscf_2", act); zfcp_dbf_rec_action("erscf_2", act);
if (act->fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
act->fsf_req = NULL; act->fsf_req_id = 0;
} else } else
act->fsf_req = NULL; act->fsf_req_id = 0;
spin_unlock(&adapter->req_list_lock); spin_unlock(&adapter->req_list_lock);
} }
......
...@@ -773,10 +773,11 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) ...@@ -773,10 +773,11 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
unsigned long flags; unsigned long flags;
int idx; int idx;
int with_qtcb = (req->qtcb != NULL); int with_qtcb = (req->qtcb != NULL);
int req_id = req->req_id;
/* put allocated FSF request into hash table */ /* put allocated FSF request into hash table */
spin_lock_irqsave(&adapter->req_list_lock, flags); spin_lock_irqsave(&adapter->req_list_lock, flags);
idx = zfcp_reqlist_hash(req->req_id); idx = zfcp_reqlist_hash(req_id);
list_add_tail(&req->list, &adapter->req_list[idx]); list_add_tail(&req->list, &adapter->req_list[idx]);
spin_unlock_irqrestore(&adapter->req_list_lock, flags); spin_unlock_irqrestore(&adapter->req_list_lock, flags);
...@@ -786,7 +787,8 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) ...@@ -786,7 +787,8 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
del_timer(&req->timer); del_timer(&req->timer);
spin_lock_irqsave(&adapter->req_list_lock, flags); spin_lock_irqsave(&adapter->req_list_lock, flags);
/* lookup request again, list might have changed */ /* lookup request again, list might have changed */
if (zfcp_reqlist_find_safe(adapter, req)) req = zfcp_reqlist_find(adapter, req_id);
if (req)
zfcp_reqlist_remove(adapter, req); zfcp_reqlist_remove(adapter, req);
spin_unlock_irqrestore(&adapter->req_list_lock, flags); spin_unlock_irqrestore(&adapter->req_list_lock, flags);
zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); 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,13 +1264,13 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
FSF_FEATURE_UPDATE_ALERT; FSF_FEATURE_UPDATE_ALERT;
req->erp_action = erp_action; req->erp_action = erp_action;
req->handler = zfcp_fsf_exchange_config_data_handler; req->handler = zfcp_fsf_exchange_config_data_handler;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -1355,13 +1357,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) ...@@ -1355,13 +1357,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
req->handler = zfcp_fsf_exchange_port_data_handler; req->handler = zfcp_fsf_exchange_port_data_handler;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -1521,14 +1523,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) ...@@ -1521,14 +1523,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
hton24(req->qtcb->bottom.support.d_id, port->d_id); hton24(req->qtcb->bottom.support.d_id, port->d_id);
req->data = port; req->data = port;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
get_device(&port->sysfs_device); get_device(&port->sysfs_device);
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
put_device(&port->sysfs_device); put_device(&port->sysfs_device);
} }
out: out:
...@@ -1591,13 +1593,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) ...@@ -1591,13 +1593,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
req->data = erp_action->port; req->data = erp_action->port;
req->erp_action = erp_action; req->erp_action = erp_action;
req->qtcb->header.port_handle = erp_action->port->handle; req->qtcb->header.port_handle = erp_action->port->handle;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -1817,13 +1819,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) ...@@ -1817,13 +1819,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
req->qtcb->header.port_handle = erp_action->port->handle; req->qtcb->header.port_handle = erp_action->port->handle;
req->erp_action = erp_action; req->erp_action = erp_action;
req->handler = zfcp_fsf_close_physical_port_handler; req->handler = zfcp_fsf_close_physical_port_handler;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -1991,7 +1993,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) ...@@ -1991,7 +1993,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
req->handler = zfcp_fsf_open_unit_handler; req->handler = zfcp_fsf_open_unit_handler;
req->data = erp_action->unit; req->data = erp_action->unit;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING; 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,7 +2002,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -2077,13 +2079,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) ...@@ -2077,13 +2079,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
req->handler = zfcp_fsf_close_unit_handler; req->handler = zfcp_fsf_close_unit_handler;
req->data = erp_action->unit; req->data = erp_action->unit;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req = req; erp_action->fsf_req_id = req->req_id;
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req_id = 0;
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment