[patch 3/6] SCSI HCIL: add scsi_scan_target()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



__spi_scan_target() becomes a wrapper around __scsi_scan_target()

Signed-off-by: Jeff Garzik <jgarzik@xxxxxxxxx>


eb622527338014ebd80e10d60821d1f1559e2ac3
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0cbcbe7..92fc94b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1306,23 +1306,11 @@ void scsi_rescan_device(struct device *d
 }
 EXPORT_SYMBOL(scsi_rescan_device);
 
-static void __spi_scan_target(struct device *parent, unsigned int channel,
-		unsigned int id, unsigned int lun, int rescan)
+static void __scsi_scan_target(struct scsi_target *starget,
+		unsigned int lun, int rescan)
 {
-	struct Scsi_Host *shost = dev_to_shost(parent);
 	int bflags = 0;
 	int res;
-	struct scsi_target *starget;
-
-	if (shost->this_id == id)
-		/*
-		 * Don't scan the host adapter
-		 */
-		return;
-
-	starget = scsi_alloc_target(parent, channel, id);
-	if (!starget)
-		return;
 
 	get_device(&starget->dev);
 	if (lun != SCAN_WILD_CARD) {
@@ -1356,6 +1344,23 @@ static void __spi_scan_target(struct dev
 	put_device(&starget->dev);
 }
 
+static void __spi_scan_target(struct device *parent, unsigned int channel,
+		unsigned int id, unsigned int lun, int rescan)
+{
+	struct Scsi_Host *shost = dev_to_shost(parent);
+	struct scsi_target *starget;
+
+	if (shost->this_id == id)
+		/*
+		 * Don't scan the host adapter
+		 */
+		return;
+
+	starget = scsi_alloc_target(parent, channel, id);
+	if (starget)
+		__scsi_scan_target(starget, lun, rescan);
+}
+
 /**
  * spi_scan_target - scan a target id, possibly including all LUNs on the
  *     target.
@@ -1384,6 +1389,31 @@ void spi_scan_target(struct device *pare
 }
 EXPORT_SYMBOL(spi_scan_target);
 
+/**
+ * scsi_scan_target - scan a target id, possibly including all LUNs on the
+ *     target.
+ * @target:	target to scan
+ * @lun:	Specific LUN to scan or SCAN_WILD_CARD
+ * @rescan:	passed to LUN scanning routines
+ *
+ * Description:
+ *     Scan the target id on @parent, @channel, and @id. Scan at least LUN 0,
+ *     and possibly all LUNs on the target id.
+ *
+ *     First try a REPORT LUN scan, if that does not scan the target, do a
+ *     sequential scan of LUNs on the target id.
+ **/
+void scsi_scan_target(struct scsi_target *target, unsigned int lun, int rescan)
+{
+	struct Scsi_Host *shost = dev_to_shost(target->dev.parent);
+
+	down(&shost->scan_mutex);
+	if (scsi_host_scan_allowed(shost))
+		__scsi_scan_target(target, lun, rescan);
+	up(&shost->scan_mutex);
+}
+EXPORT_SYMBOL(scsi_scan_target);
+
 static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
 			      unsigned int id, unsigned int lun, int rescan)
 {
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 814a7d8..c7cdb23 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -250,6 +250,8 @@ extern void scsi_target_quiesce(struct s
 extern void scsi_target_resume(struct scsi_target *);
 extern void spi_scan_target(struct device *parent, unsigned int channel,
 			    unsigned int id, unsigned int lun, int rescan);
+extern void scsi_scan_target(struct scsi_target *target,
+			     unsigned int lun, int rescan);
 extern void scsi_target_reap(struct scsi_target *);
 extern void scsi_target_block(struct device *);
 extern void scsi_target_unblock(struct device *);
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux