[Open-FCoE] [PATCH 5/5] libfc: move fc_block_rports() from fc_ns.c to fc_rport.c

Chris Leech christopher.leech at intel.com
Thu Sep 25 19:07:59 UTC 2008


Signed-off-by: Chris Leech <christopher.leech at intel.com>
---

 drivers/scsi/libfc/fc_lport.c |    2 --
 drivers/scsi/libfc/fc_ns.c    |   35 -----------------------------------
 drivers/scsi/libfc/fc_rport.c |   35 +++++++++++++++++++++++++++++++++++
 include/scsi/libfc/libfc.h    |    1 +
 4 files changed, 36 insertions(+), 37 deletions(-)


diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 0f33f20..ad375aa 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -664,8 +664,6 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 	lp->tt.exch_done(sp);
 }
 
-extern void fc_block_rports(struct fc_lport *lp);
-
 /*
  * Put the local port back into the initial state.  Reset all sessions.
  * This is called after a SCSI reset or the driver is unloading
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index db77742..fc096ef 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -358,41 +358,6 @@ static int fc_ns_restart(struct fc_lport *lp)
 	return 0;
 }
 
-/**
- * fc_block_rports - delete all the remote ports, on reset or link down
- * @lp: libfc local port instance
- *
- * This routine temporarily removes any online remote ports from the fc_host
- * rport list, then drops the host lock in order to call fc_remote_port_delete()
- * on each rport in turn, and finally splices the list back onto the fc_host.
- */
-void fc_block_rports(struct fc_lport *lp)
-{
-	struct Scsi_Host *shost = lp->host;
-	struct fc_rport *rport, *next;
-	unsigned long flags;
-	LIST_HEAD(rports);
-
-	spin_lock_irqsave(shost->host_lock, flags);
-	list_for_each_entry_safe(rport, next, &fc_host_rports(shost), peers) {
-		/* protect the name service remote port */
-		if (rport == lp->dns_rp)
-			continue;
-		if (rport->port_state != FC_PORTSTATE_ONLINE)
-			continue;
-		list_move_tail(&rport->peers, &rports);
-	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
-
-	list_for_each_entry(rport, &rports, peers) {
-		fc_remote_port_delete(rport);
-	}
-
-	spin_lock_irqsave(shost->host_lock, flags);
-	list_splice(&rports, &fc_host_rports(shost));
-	spin_unlock_irqrestore(shost->host_lock, flags);
-}
-
 /*
  * Fibre Channel Target discovery.
  *
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 91cc0d5..4392c01 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -1299,6 +1299,41 @@ int fc_rport_init(struct fc_lport *lp)
 }
 EXPORT_SYMBOL(fc_rport_init);
 
+/**
+ * fc_block_rports - delete all the remote ports, on reset or link down
+ * @lp: libfc local port instance
+ *
+ * This routine temporarily removes any online remote ports from the fc_host
+ * rport list, then drops the host lock in order to call fc_remote_port_delete()
+ * on each rport in turn, and finally splices the list back onto the fc_host.
+ */
+void fc_block_rports(struct fc_lport *lp)
+{
+	struct Scsi_Host *shost = lp->host;
+	struct fc_rport *rport, *next;
+	unsigned long flags;
+	LIST_HEAD(rports);
+
+	spin_lock_irqsave(shost->host_lock, flags);
+	list_for_each_entry_safe(rport, next, &fc_host_rports(shost), peers) {
+		/* protect the name service remote port */
+		if (rport == lp->dns_rp)
+			continue;
+		if (rport->port_state != FC_PORTSTATE_ONLINE)
+			continue;
+		list_move_tail(&rport->peers, &rports);
+	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
+	list_for_each_entry(rport, &rports, peers) {
+		fc_remote_port_delete(rport);
+	}
+
+	spin_lock_irqsave(shost->host_lock, flags);
+	list_splice(&rports, &fc_host_rports(shost));
+	spin_unlock_irqrestore(shost->host_lock, flags);
+}
+
 void fc_rport_terminate_io(struct fc_rport *rport)
 {
 	struct fc_rport_libfc_priv *rp = rport->dd_data;
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index d56e526..d3232ea 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -561,6 +561,7 @@ int fc_set_mfs(struct fc_lport *lp, u32 mfs);
  *****************************/
 int fc_rport_init(struct fc_lport *lp);
 void fc_rport_terminate_io(struct fc_rport *rp);
+void fc_block_rports(struct fc_lport *lp);
 
 
 /**




More information about the devel mailing list