Skip to content

Commit e60a6d6

Browse files
Christof SchmittJames Bottomley
authored andcommitted
[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 <[email protected]> Signed-off-by: Christof Schmitt <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent cae727d commit e60a6d6

File tree

4 files changed

+29
-41
lines changed

4 files changed

+29
-41
lines changed

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
668668
r->u.action.action = (unsigned long)erp_action;
669669
r->u.action.status = erp_action->status;
670670
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;
672672
debug_event(dbf->rec, 5, r, sizeof(*r));
673673
spin_unlock_irqrestore(&dbf->rec_lock, flags);
674674
}

drivers/s390/scsi/zfcp_def.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ struct zfcp_erp_action {
143143
struct zfcp_unit *unit;
144144
u32 status; /* recovery status */
145145
u32 step; /* active step of this erp action */
146-
struct zfcp_fsf_req *fsf_req; /* fsf request currently pending
147-
for this action */
146+
unsigned long fsf_req_id;
148147
struct timer_list timer;
149148
};
150149

@@ -379,18 +378,4 @@ zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
379378
return NULL;
380379
}
381380

382-
static inline struct zfcp_fsf_req *
383-
zfcp_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-
396381
#endif /* ZFCP_DEF_H */

drivers/s390/scsi/zfcp_erp.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,25 +478,26 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
478478
static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
479479
{
480480
struct zfcp_adapter *adapter = act->adapter;
481+
struct zfcp_fsf_req *req;
481482

482-
if (!act->fsf_req)
483+
if (!act->fsf_req_id)
483484
return;
484485

485486
spin_lock(&adapter->req_list_lock);
486-
if (zfcp_reqlist_find_safe(adapter, act->fsf_req) &&
487-
act->fsf_req->erp_action == act) {
487+
req = zfcp_reqlist_find(adapter, act->fsf_req_id);
488+
if (req && req->erp_action == act) {
488489
if (act->status & (ZFCP_STATUS_ERP_DISMISSED |
489490
ZFCP_STATUS_ERP_TIMEDOUT)) {
490-
act->fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
491+
req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
491492
zfcp_dbf_rec_action("erscf_1", act);
492-
act->fsf_req->erp_action = NULL;
493+
req->erp_action = NULL;
493494
}
494495
if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
495496
zfcp_dbf_rec_action("erscf_2", act);
496-
if (act->fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
497-
act->fsf_req = NULL;
497+
if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
498+
act->fsf_req_id = 0;
498499
} else
499-
act->fsf_req = NULL;
500+
act->fsf_req_id = 0;
500501
spin_unlock(&adapter->req_list_lock);
501502
}
502503

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,11 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
773773
unsigned long flags;
774774
int idx;
775775
int with_qtcb = (req->qtcb != NULL);
776+
int req_id = req->req_id;
776777

777778
/* put allocated FSF request into hash table */
778779
spin_lock_irqsave(&adapter->req_list_lock, flags);
779-
idx = zfcp_reqlist_hash(req->req_id);
780+
idx = zfcp_reqlist_hash(req_id);
780781
list_add_tail(&req->list, &adapter->req_list[idx]);
781782
spin_unlock_irqrestore(&adapter->req_list_lock, flags);
782783

@@ -786,7 +787,8 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
786787
del_timer(&req->timer);
787788
spin_lock_irqsave(&adapter->req_list_lock, flags);
788789
/* 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)
790792
zfcp_reqlist_remove(adapter, req);
791793
spin_unlock_irqrestore(&adapter->req_list_lock, flags);
792794
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)
12621264
FSF_FEATURE_UPDATE_ALERT;
12631265
req->erp_action = erp_action;
12641266
req->handler = zfcp_fsf_exchange_config_data_handler;
1265-
erp_action->fsf_req = req;
1267+
erp_action->fsf_req_id = req->req_id;
12661268

12671269
zfcp_fsf_start_erp_timer(req);
12681270
retval = zfcp_fsf_req_send(req);
12691271
if (retval) {
12701272
zfcp_fsf_req_free(req);
1271-
erp_action->fsf_req = NULL;
1273+
erp_action->fsf_req_id = 0;
12721274
}
12731275
out:
12741276
spin_unlock_bh(&qdio->req_q_lock);
@@ -1355,13 +1357,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
13551357

13561358
req->handler = zfcp_fsf_exchange_port_data_handler;
13571359
req->erp_action = erp_action;
1358-
erp_action->fsf_req = req;
1360+
erp_action->fsf_req_id = req->req_id;
13591361

13601362
zfcp_fsf_start_erp_timer(req);
13611363
retval = zfcp_fsf_req_send(req);
13621364
if (retval) {
13631365
zfcp_fsf_req_free(req);
1364-
erp_action->fsf_req = NULL;
1366+
erp_action->fsf_req_id = 0;
13651367
}
13661368
out:
13671369
spin_unlock_bh(&qdio->req_q_lock);
@@ -1521,14 +1523,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
15211523
hton24(req->qtcb->bottom.support.d_id, port->d_id);
15221524
req->data = port;
15231525
req->erp_action = erp_action;
1524-
erp_action->fsf_req = req;
1526+
erp_action->fsf_req_id = req->req_id;
15251527
get_device(&port->sysfs_device);
15261528

15271529
zfcp_fsf_start_erp_timer(req);
15281530
retval = zfcp_fsf_req_send(req);
15291531
if (retval) {
15301532
zfcp_fsf_req_free(req);
1531-
erp_action->fsf_req = NULL;
1533+
erp_action->fsf_req_id = 0;
15321534
put_device(&port->sysfs_device);
15331535
}
15341536
out:
@@ -1591,13 +1593,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
15911593
req->data = erp_action->port;
15921594
req->erp_action = erp_action;
15931595
req->qtcb->header.port_handle = erp_action->port->handle;
1594-
erp_action->fsf_req = req;
1596+
erp_action->fsf_req_id = req->req_id;
15951597

15961598
zfcp_fsf_start_erp_timer(req);
15971599
retval = zfcp_fsf_req_send(req);
15981600
if (retval) {
15991601
zfcp_fsf_req_free(req);
1600-
erp_action->fsf_req = NULL;
1602+
erp_action->fsf_req_id = 0;
16011603
}
16021604
out:
16031605
spin_unlock_bh(&qdio->req_q_lock);
@@ -1817,13 +1819,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
18171819
req->qtcb->header.port_handle = erp_action->port->handle;
18181820
req->erp_action = erp_action;
18191821
req->handler = zfcp_fsf_close_physical_port_handler;
1820-
erp_action->fsf_req = req;
1822+
erp_action->fsf_req_id = req->req_id;
18211823

18221824
zfcp_fsf_start_erp_timer(req);
18231825
retval = zfcp_fsf_req_send(req);
18241826
if (retval) {
18251827
zfcp_fsf_req_free(req);
1826-
erp_action->fsf_req = NULL;
1828+
erp_action->fsf_req_id = 0;
18271829
}
18281830
out:
18291831
spin_unlock_bh(&qdio->req_q_lock);
@@ -1991,7 +1993,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
19911993
req->handler = zfcp_fsf_open_unit_handler;
19921994
req->data = erp_action->unit;
19931995
req->erp_action = erp_action;
1994-
erp_action->fsf_req = req;
1996+
erp_action->fsf_req_id = req->req_id;
19951997

19961998
if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
19971999
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)
20002002
retval = zfcp_fsf_req_send(req);
20012003
if (retval) {
20022004
zfcp_fsf_req_free(req);
2003-
erp_action->fsf_req = NULL;
2005+
erp_action->fsf_req_id = 0;
20042006
}
20052007
out:
20062008
spin_unlock_bh(&qdio->req_q_lock);
@@ -2077,13 +2079,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
20772079
req->handler = zfcp_fsf_close_unit_handler;
20782080
req->data = erp_action->unit;
20792081
req->erp_action = erp_action;
2080-
erp_action->fsf_req = req;
2082+
erp_action->fsf_req_id = req->req_id;
20812083

20822084
zfcp_fsf_start_erp_timer(req);
20832085
retval = zfcp_fsf_req_send(req);
20842086
if (retval) {
20852087
zfcp_fsf_req_free(req);
2086-
erp_action->fsf_req = NULL;
2088+
erp_action->fsf_req_id = 0;
20872089
}
20882090
out:
20892091
spin_unlock_bh(&qdio->req_q_lock);

0 commit comments

Comments
 (0)