public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* LDM scsi upper level updates and scsihosts parm
@ 2003-05-31  1:08 Mike Anderson
  2003-05-31  9:32 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Anderson @ 2003-05-31  1:08 UTC (permalink / raw)
  To: linux-scsi

The sysfs changes to allow the upper level to bind through the driver
model interfaces breaks the usage of the scsihosts parm. I did not
notice this the other day as I was running with one built-in driver and
many modules.

I know there are issues with using scsihosts today (i.e., does not
work if you come in after the upper levels have inited).

Are we going to remove the scsihosts parm or do we need a solution for
this?

-andmike
--
Michael Anderson
andmike@us.ibm.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LDM scsi upper level updates and scsihosts parm
  2003-05-31  1:08 LDM scsi upper level updates and scsihosts parm Mike Anderson
@ 2003-05-31  9:32 ` Christoph Hellwig
  2003-06-03 20:08   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-05-31  9:32 UTC (permalink / raw)
  To: linux-scsi

On Fri, May 30, 2003 at 06:08:45PM -0700, Mike Anderson wrote:
> The sysfs changes to allow the upper level to bind through the driver
> model interfaces breaks the usage of the scsihosts parm. I did not
> notice this the other day as I was running with one built-in driver and
> many modules.
> 
> I know there are issues with using scsihosts today (i.e., does not
> work if you come in after the upper levels have inited).
> 
> Are we going to remove the scsihosts parm or do we need a solution for
> this?

I think we should remove it.  It's racy and we have proper ways to identify
filesysystems bz label/uuid or scsi hosts by the sysfs output nowdays.

Btw, did someone update the scsidev util to use 2.5 sysfs output?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LDM scsi upper level updates and scsihosts parm
  2003-05-31  9:32 ` Christoph Hellwig
@ 2003-06-03 20:08   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2003-06-03 20:08 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi

On Sat, May 31, 2003 at 10:32:55AM +0100, Christoph Hellwig wrote:
> I think we should remove it.  It's racy and we have proper ways to identify
> filesysystems by label/uuid or scsi hosts by the sysfs output nowdays.

Okay, here's a patch to kill it.  


diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	Tue Jun  3 00:18:19 2003
+++ b/drivers/scsi/hosts.c	Tue Jun  3 00:18:19 2003
@@ -51,96 +51,6 @@
 static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED;
 
 static int scsi_host_next_hn;		/* host_no for next new host */
-static char *scsihosts;
-
-MODULE_PARM(scsihosts, "s");
-MODULE_PARM_DESC(scsihosts, "scsihosts=driver1,driver2,driver3");
-#ifndef MODULE
-int __init scsi_setup(char *str)
-{
-	scsihosts = str;
-	return 1;
-}
-
-__setup("scsihosts=", scsi_setup);
-#endif
-
-/**
-  * scsi_find_host_by_num - get a Scsi_Host by host no
-  *
-  * @host_no:	host number to locate
-  *
-  * Return value:
-  *	A pointer to located Scsi_Host or NULL.
-  **/
-static struct Scsi_Host *scsi_find_host_by_num(unsigned short host_no)
-{
-	struct Scsi_Host *shost, *shost_found = NULL;
-
-	spin_lock(&scsi_host_list_lock);
-	list_for_each_entry(shost, &scsi_host_list, sh_list) {
-		if (shost->host_no > host_no) {
-			/*
-			 * The list is sorted.
-			 */
-			break;
-		} else if (shost->host_no == host_no) {
-			shost_found = shost;
-			break;
-		}
-	}
-	spin_unlock(&scsi_host_list_lock);
-	return shost_found;
-}
-
-/**
- * scsi_alloc_hostnum - choose new SCSI host number based on host name.
- * @name:	String to store in name field
- *
- * Return value:
- *	Pointer to a new Scsi_Host_Name
- **/
-static int scsi_alloc_host_num(const char *name)
-{
-	int hostnum;
-	int namelen;
-	const char *start, *end;
-
-	if (name) {
-		hostnum = 0;
-		namelen = strlen(name);
-		start = scsihosts; 
-		while (1) {
-			int hostlen;
-
-			if (start && start[0] != '\0') {
-				end = strpbrk(start, ",:");
-				if (end) {
-					hostlen = (end - start);
-					end++;
-				} else
-					hostlen = strlen(start);
-				/*
-				 * Look for a match on the scsihosts list.
-				 */
-				if ((hostlen == namelen) && 
-				    (strncmp(name, start, hostlen) == 0) && 
-				    (!scsi_find_host_by_num(hostnum)))
-					return hostnum;
-				start = end;
-			} else  {
-				/*
-				 * Look for any unused numbers.
-				 */
-				if (!scsi_find_host_by_num(hostnum))
-					return hostnum;
-			}
-			hostnum++;
-		}
-	} else
-		return scsi_host_next_hn++;
-}
-
 
 /**
  * scsi_tp_for_each_host - call function for each scsi host off a template
@@ -331,7 +241,7 @@
 
 	memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
 
-	shost->host_no = scsi_alloc_host_num(shost_tp->proc_name);
+	shost->host_no = scsi_host_next_hn++; /* XXX(hch): still racy */
 
 	spin_lock_init(&shost->default_lock);
 	scsi_assign_lock(shost, &shost->default_lock);
@@ -536,26 +446,8 @@
  **/
 void scsi_host_put(struct Scsi_Host *shost)
 {
-
 	class_device_put(&shost->class_dev);
 	put_device(&shost->host_gendev);
-}
-
-/**
- * scsi_host_init - set up the scsi host number list based on any entries
- * scsihosts.
- **/
-void __init scsi_host_init(void)
-{
-	char *shost_hn;
-
-	shost_hn = scsihosts;
-	while (shost_hn) {
-		scsi_host_next_hn++;
-		shost_hn = strpbrk(shost_hn, ":,");
-		if (shost_hn)
-			shost_hn++;
-	}
 }
 
 void scsi_host_busy_inc(struct Scsi_Host *shost, Scsi_Device *sdev)
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c	Tue Jun  3 00:18:19 2003
+++ b/drivers/scsi/scsi.c	Tue Jun  3 00:18:19 2003
@@ -1003,7 +1003,6 @@
 	for (i = 0; i < NR_CPUS; i++)
 		INIT_LIST_HEAD(&done_q[i]);
 
-	scsi_host_init();
 	devfs_mk_dir("scsi");
 	open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
 	printk(KERN_NOTICE "SCSI subsystem initialized\n");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-03 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-31  1:08 LDM scsi upper level updates and scsihosts parm Mike Anderson
2003-05-31  9:32 ` Christoph Hellwig
2003-06-03 20:08   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox