Commit 786681b9 authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley
Browse files

[SCSI] libfc: eliminate disc->event



There was no need to have the discovery status stored in struct fc_disc.

Change fc_disc_done() to take the discovery status as an argument
and just pass it on to the discovery callback.
Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 00fea930
...@@ -49,7 +49,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *); ...@@ -49,7 +49,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *);
static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *); static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *);
static int fc_disc_new_target(struct fc_disc *, struct fc_rport_priv *, static int fc_disc_new_target(struct fc_disc *, struct fc_rport_priv *,
struct fc_rport_identifiers *); struct fc_rport_identifiers *);
static void fc_disc_done(struct fc_disc *); static void fc_disc_done(struct fc_disc *, enum fc_disc_event);
static void fc_disc_timeout(struct work_struct *); static void fc_disc_timeout(struct work_struct *);
static void fc_disc_single(struct fc_disc *, struct fc_disc_port *); static void fc_disc_single(struct fc_disc *, struct fc_disc_port *);
static void fc_disc_restart(struct fc_disc *); static void fc_disc_restart(struct fc_disc *);
...@@ -329,8 +329,7 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *, ...@@ -329,8 +329,7 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *,
if (rdata) { if (rdata) {
kref_get(&rdata->kref); kref_get(&rdata->kref);
if (!fc_disc_new_target(disc, rdata, &rdata->ids)) { if (!fc_disc_new_target(disc, rdata, &rdata->ids)) {
disc->event = DISC_EV_SUCCESS; fc_disc_done(disc, DISC_EV_SUCCESS);
fc_disc_done(disc);
} }
kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy);
} else { } else {
...@@ -404,20 +403,18 @@ static int fc_disc_new_target(struct fc_disc *disc, ...@@ -404,20 +403,18 @@ static int fc_disc_new_target(struct fc_disc *disc,
/** /**
* fc_disc_done() - Discovery has been completed * fc_disc_done() - Discovery has been completed
* @disc: FC discovery context * @disc: FC discovery context
* @event: discovery completion status
*
* Locking Note: This function expects that the disc mutex is locked before * Locking Note: This function expects that the disc mutex is locked before
* it is called. The discovery callback is then made with the lock released, * it is called. The discovery callback is then made with the lock released,
* and the lock is re-taken before returning from this function * and the lock is re-taken before returning from this function
*/ */
static void fc_disc_done(struct fc_disc *disc) static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
{ {
struct fc_lport *lport = disc->lport; struct fc_lport *lport = disc->lport;
enum fc_disc_event event;
FC_DISC_DBG(disc, "Discovery complete\n"); FC_DISC_DBG(disc, "Discovery complete\n");
event = disc->event;
disc->event = DISC_EV_NONE;
if (disc->requested) if (disc->requested)
fc_disc_gpn_ft_req(disc); fc_disc_gpn_ft_req(disc);
else else
...@@ -460,11 +457,8 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp) ...@@ -460,11 +457,8 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
} }
disc->retry_count++; disc->retry_count++;
schedule_delayed_work(&disc->disc_work, delay); schedule_delayed_work(&disc->disc_work, delay);
} else { } else
/* exceeded retries */ fc_disc_done(disc, DISC_EV_FAILED);
disc->event = DISC_EV_FAILED;
fc_disc_done(disc);
}
} }
} }
...@@ -503,10 +497,12 @@ err: ...@@ -503,10 +497,12 @@ err:
} }
/** /**
* fc_disc_gpn_ft_parse() - Parse the list of IDs and names resulting from a request * fc_disc_gpn_ft_parse() - Parse the body of the dNS GPN_FT response.
* @lport: Fibre Channel host port instance * @lport: Fibre Channel host port instance
* @buf: GPN_FT response buffer * @buf: GPN_FT response buffer
* @len: size of response buffer * @len: size of response buffer
*
* Goes through the list of IDs and names resulting from a request.
*/ */
static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
{ {
...@@ -577,8 +573,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) ...@@ -577,8 +573,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
} }
if (np->fp_flags & FC_NS_FID_LAST) { if (np->fp_flags & FC_NS_FID_LAST) {
disc->event = DISC_EV_SUCCESS; fc_disc_done(disc, DISC_EV_SUCCESS);
fc_disc_done(disc);
len = 0; len = 0;
break; break;
} }
...@@ -669,8 +664,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -669,8 +664,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
FC_DISC_DBG(disc, "GPN_FT rejected reason %x exp %x " FC_DISC_DBG(disc, "GPN_FT rejected reason %x exp %x "
"(check zoning)\n", cp->ct_reason, "(check zoning)\n", cp->ct_reason,
cp->ct_explan); cp->ct_explan);
disc->event = DISC_EV_FAILED; fc_disc_done(disc, DISC_EV_FAILED);
fc_disc_done(disc);
} else { } else {
FC_DISC_DBG(disc, "GPN_FT unexpected response code " FC_DISC_DBG(disc, "GPN_FT unexpected response code "
"%x\n", ntohs(cp->ct_cmd)); "%x\n", ntohs(cp->ct_cmd));
...@@ -782,7 +776,6 @@ int fc_disc_init(struct fc_lport *lport) ...@@ -782,7 +776,6 @@ int fc_disc_init(struct fc_lport *lport)
disc->lport = lport; disc->lport = lport;
disc->delay = FC_DISC_DELAY; disc->delay = FC_DISC_DELAY;
disc->event = DISC_EV_NONE;
return 0; return 0;
} }
......
...@@ -679,7 +679,6 @@ struct fc_disc { ...@@ -679,7 +679,6 @@ struct fc_disc {
unsigned char requested; unsigned char requested;
unsigned short seq_count; unsigned short seq_count;
unsigned char buf_len; unsigned char buf_len;
enum fc_disc_event event;
void (*disc_callback)(struct fc_lport *, void (*disc_callback)(struct fc_lport *,
enum fc_disc_event); enum fc_disc_event);
......
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