linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
@ 2002-11-04 16:22 Adam J. Richter
  0 siblings, 0 replies; 11+ messages in thread
From: Adam J. Richter @ 2002-11-04 16:22 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

	It looks like scsi_host_tmp_list and template.shtp_list are
not used.  This patch deletes them, but I have not tested beyond
verifying that my hosts.c still compiles.

	This is a step toward eliminating the need for a routine to
register scsi templates at all (modules would just register SCSI
hosts, simplifying hot plugging of controllers).

-- 
Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

[-- Attachment #2: scsi.diff --]
[-- Type: text/plain, Size: 1650 bytes --]

--- linux-2.5.45/drivers/scsi/hosts.h	2002-10-30 16:42:24.000000000 -0800
+++ linux/drivers/scsi/hosts.h	2002-11-04 08:10:05.000000000 -0800
@@ -58,8 +58,6 @@
 typedef struct	SHT
 {
 
-    struct list_head	shtp_list;
-
     /* Used with loadable modules so that we know when it is safe to unload */
     struct module * module;
 
@@ -326,6 +324,11 @@
      */
     unsigned use_blk_tcq:1;
 
+    /* Have the high level code automatically handle DMA mapping of
+       Scsi_Request->request_buffer and Scsi_Request->sense_buf. */
+    unsigned dma_map_request:1;
+    unsigned dma_map_sense:1;
+
     /*
      * Name of proc directory
      */
--- linux-2.5.45/drivers/scsi/hosts.c	2002-10-30 16:41:40.000000000 -0800
+++ linux/drivers/scsi/hosts.c	2002-11-04 08:09:58.000000000 -0800
@@ -45,7 +45,6 @@
 #include "scsi.h"
 #include "hosts.h"
 
-LIST_HEAD(scsi_host_tmpl_list);
 LIST_HEAD(scsi_host_hn_list);
 
 LIST_HEAD(scsi_host_list);
@@ -475,8 +474,6 @@
 	struct list_head *lh;
 	struct Scsi_Host *shost;
 
-	INIT_LIST_HEAD(&shost_tp->shtp_list);
-
 	/*
 	 * Check no detect routine.
 	 */
@@ -526,8 +523,6 @@
 			}
 		}
 
-		list_add_tail(&shost_tp->shtp_list, &scsi_host_tmpl_list);
-
 		/* The next step is to call scan_scsis here.  This generates the
 		 * Scsi_Devices entries
 		 */
@@ -614,14 +609,6 @@
 		printk(KERN_INFO "scsi : %d host%s left.\n", scsi_hosts_registered,
 		       (scsi_hosts_registered == 1) ? "" : "s");
 
-	/*
-	 * Remove it from the list if all
-	 * hosts were successfully removed (ie preset == 0)
-	 */
-	if (!shost_tp->present) {
-		list_del(&shost_tp->shtp_list);
-	}
-
 	MOD_DEC_USE_COUNT;
 
 	unlock_kernel();

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
@ 2002-11-05 12:20 Adam J. Richter
  2002-11-05 22:58 ` Christoph Hellwig
  2002-11-05 23:54 ` Christoph Hellwig
  0 siblings, 2 replies; 11+ messages in thread
From: Adam J. Richter @ 2002-11-05 12:20 UTC (permalink / raw)
  To: hch, James.Bottomley; +Cc: linux-scsi

	Oops, I see that Chrisoph Hellwig posted a patch 19.5 earlier
than mine that did this clean up and some other related ones, so please
disregard my patch and apply Christoph's.

	Chistoph, since you're in the process of doing similar
clean-ups, you might want to try my untested patch that eliminated
Scsi_Host_Name:

	 http://marc.theaimsgroup.com/?l=linux-scsi&m=103643303212376&w=2

	If it works and looks OK to you, Christoph, I'd encourage you
to put it into your patch stream if you want, so as to reduce patch
conflicts for James, Linus, et al.  On the other hand, if that just
creates work for you that you weren't keen on doing, don't worry about
it.  I don't mean to impose.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-05 12:20 Adam J. Richter
@ 2002-11-05 22:58 ` Christoph Hellwig
  2002-11-05 23:54 ` Christoph Hellwig
  1 sibling, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2002-11-05 22:58 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: James.Bottomley, linux-scsi

On Tue, Nov 05, 2002 at 04:20:15AM -0800, Adam J. Richter wrote:
> 	Oops, I see that Chrisoph Hellwig posted a patch 19.5 earlier
> than mine that did this clean up and some other related ones, so please
> disregard my patch and apply Christoph's.
> 
> 	Chistoph, since you're in the process of doing similar
> clean-ups, you might want to try my untested patch that eliminated
> Scsi_Host_Name:
> 
> 	 http://marc.theaimsgroup.com/?l=linux-scsi&m=103643303212376&w=2
> 
> 	If it works and looks OK to you, Christoph, I'd encourage you
> to put it into your patch stream if you want, so as to reduce patch
> conflicts for James, Linus, et al.  On the other hand, if that just
> creates work for you that you weren't keen on doing, don't worry about
> it.  I don't mean to impose.

I'll take a look at it now.


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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-05 12:20 Adam J. Richter
  2002-11-05 22:58 ` Christoph Hellwig
@ 2002-11-05 23:54 ` Christoph Hellwig
  2002-11-07  1:13   ` Patrick Mansfield
  1 sibling, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2002-11-05 23:54 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: James.Bottomley, linux-scsi

On Tue, Nov 05, 2002 at 04:20:15AM -0800, Adam J. Richter wrote:
> 	Oops, I see that Chrisoph Hellwig posted a patch 19.5 earlier
> than mine that did this clean up and some other related ones, so please
> disregard my patch and apply Christoph's.
> 
> 	Chistoph, since you're in the process of doing similar
> clean-ups, you might want to try my untested patch that eliminated
> Scsi_Host_Name:
> 
> 	 http://marc.theaimsgroup.com/?l=linux-scsi&m=103643303212376&w=2
> 
> 	If it works and looks OK to you, Christoph, I'd encourage you
> to put it into your patch stream if you want, so as to reduce patch
> conflicts for James, Linus, et al.  On the other hand, if that just
> creates work for you that you weren't keen on doing, don't worry about
> it.  I don't mean to impose.

Okay, here's a version with minimal cleanups (different placements of
the functions, use of list_for_each_entry, etc..) against
scsi-for-linus-2.5.  Patch looks fine to me, but I had no chance to
actually test the boot argument.

--- 1.22/drivers/scsi/hosts.c	Mon Nov  4 17:04:04 2002
+++ edited/drivers/scsi/hosts.c	Tue Nov  5 23:44:01 2002
@@ -45,12 +45,69 @@
 #include "scsi.h"
 #include "hosts.h"
 
-static LIST_HEAD(scsi_host_hn_list);
 static LIST_HEAD(scsi_host_list);
 static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED;
 
 static int scsi_host_next_hn;		/* host_no for next new host */
 static int scsi_hosts_registered;	/* cnt of registered scsi hosts */
+static char *scsihosts;
+
+/**
+  * scsi_find_host_by_num - get a Scsi_Host by host no and inc ref count
+  *			    scsi_host_list_lock must be held by caller.
+  * @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;
+
+	spin_lock(&scsi_host_list_lock);
+	list_for_each_entry(shost, &scsi_host_list, sh_list) {
+		if (shost->host_no == host_no) {
+			spin_unlock(&scsi_host_list_lock);
+			return shost;
+		}
+	}
+	spin_unlock(&scsi_host_list_lock);
+	return NULL;
+}
+
+/**
+ * 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 = 0;
+
+	if (name && scsihosts && scsihosts[0] != '\0') {
+		const int namelen = strlen(name);
+		const char *start, *end;
+
+		for (start = scsihosts; start; start = end, hostnum++) {
+			int hostlen;
+
+			end = strpbrk(start, ",:");
+			hostlen = end ? (end - start) : strlen(start);
+
+			if (hostlen != namelen)
+				continue;
+			if (strncmp(name, start, hostlen))
+				continue;
+			if (scsi_find_host_by_num(hostnum))
+				continue;
+			return hostnum;
+		}
+	}
+
+	return scsi_host_next_hn++;
+}
 
 /**
  * scsi_tp_for_each_host - call function for each scsi host off a template
@@ -67,7 +124,6 @@
 	struct Scsi_Host *shost;
 
 	spin_lock(&scsi_host_list_lock);
-
 	list_for_each_safe(lh, lh_sf, &scsi_host_list) {
 		shost = list_entry(lh, struct Scsi_Host, sh_list);
 		if (shost->hostt == shost_tp) {
@@ -76,14 +132,12 @@
 			spin_lock(&scsi_host_list_lock);
 		}
 	}
-
 	spin_unlock(&scsi_host_list_lock);
-
 	return 0;
 }
 
 /**
- * scsi_host_generic_release - default release function for hosts
+ * scsi_host_legacy_release - default release function for hosts
  * @shost: 
  * 
  * Description:
@@ -248,24 +302,12 @@
  **/
 void scsi_unregister(struct Scsi_Host *shost)
 {
-	struct list_head *lh;
-	Scsi_Host_Name *shost_name;
-
 	/* Remove shost from scsi_host_list */
 	spin_lock(&scsi_host_list_lock);
 	list_del(&shost->sh_list);
 	spin_unlock(&scsi_host_list_lock);
 
-	/* Unregister from scsi_host_hn_list */
-	list_for_each(lh, &scsi_host_hn_list) {
-		shost_name = list_entry(lh, Scsi_Host_Name, shn_list);
-		if (shost->host_no == shost_name->host_no)
-			shost_name->host_registered = 0;
-	}
-
-	/*
-	 * Next, kill the kernel error recovery thread for this host.
-	 */
+	/* Next, kill the kernel error recovery thread for this host. */
 	if (shost->ehandler) {
 		DECLARE_MUTEX_LOCKED(sem);
 		shost->eh_notify = &sem;
@@ -283,49 +325,12 @@
 	if (!shost->hostt->present)
 		remove_proc_entry(shost->hostt->proc_name, proc_scsi);
 #endif
-	device_unregister(&shost->host_driverfs_dev);
 
+	device_unregister(&shost->host_driverfs_dev);
 	kfree(shost);
 }
 
 /**
- * scsi_host_hn_add - allocate and add new Scsi_Host_Name
- * @name:	String to store in name field
- *
- * Return value:
- * 	Pointer to a new Scsi_Host_Name
- **/
-Scsi_Host_Name *scsi_host_hn_add(char *name)
-{
-	Scsi_Host_Name *shost_name;
-	int len;
-
-	len = strlen(name);
-	shost_name =  kmalloc(sizeof(*shost_name), GFP_KERNEL);
-	if (!shost_name) {
-		printk(KERN_ERR "%s: out of memory at line %d.\n",
-		       __FUNCTION__, __LINE__);
-		return NULL;
-	}
-	shost_name->name = kmalloc(len + 1, GFP_KERNEL);
-	if (!shost_name->name) {
-		kfree(shost_name);
-		printk(KERN_ERR "%s: out of memory at line %d.\n",
-		       __FUNCTION__, __LINE__);
-		return NULL;
-	}
-
-	if (len)
-		strncpy(shost_name->name, name, len);
-	shost_name->name[len] = 0;
-	shost_name->host_no = scsi_host_next_hn++;
-	shost_name->host_registered = 0;
-	list_add_tail(&shost_name->shn_list, &scsi_host_hn_list);
-
-	return shost_name;
-}
-
-/**
  * scsi_register - register a scsi host adapter instance.
  * @shost_tp:	pointer to scsi host template
  * @xtr_bytes:	extra bytes to allocate for driver
@@ -342,10 +347,6 @@
 struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
 {
 	struct Scsi_Host *shost, *shost_scr;
-	Scsi_Host_Name *shost_name = NULL;
-	Scsi_Host_Name *shn = NULL;
-	char *hname;
-	size_t hname_len;
 	struct list_head *lh;
 	int gfp_mask;
 	DECLARE_MUTEX_LOCKED(sem);
@@ -362,33 +363,7 @@
 
 	memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
 
-	/*
-	 * Determine host number. Check reserved first before allocating
-	 * new one
-	 */
-	hname = (shost_tp->proc_name) ?  shost_tp->proc_name : "";
-	hname_len = strlen(hname);
-
-	if (hname_len)
-		list_for_each(lh, &scsi_host_hn_list) {
-			shn = list_entry(lh, Scsi_Host_Name, shn_list);
-			if (!(shn->host_registered) &&
-			    !strncmp(hname, shn->name, hname_len)) {
-				shost_name = shn;
-				break;
-			}
-		}
-
-	if (!shost_name) {
-		shost_name = scsi_host_hn_add(hname);
-		if (!shost_name) {
-			kfree(shost);
-			return NULL;
-		}
-	}
-
-	shost->host_no = shost_name->host_no;
-	shost_name->host_registered = 1;
+	shost->host_no = scsi_alloc_host_num(shost_tp->proc_name);
 	scsi_hosts_registered++;
 
 	spin_lock_init(&shost->default_lock);
@@ -431,7 +406,7 @@
 	shost->unchecked_isa_dma = shost_tp->unchecked_isa_dma;
 	shost->use_clustering = shost_tp->use_clustering;
 	if (!blk_nohighio)
-	shost->highmem_io = shost_tp->highmem_io;
+		shost->highmem_io = shost_tp->highmem_io;
 
 	shost->max_sectors = shost_tp->max_sectors;
 	shost->use_blk_tcq = shost_tp->use_blk_tcq;
@@ -637,22 +612,8 @@
  **/
 struct Scsi_Host *scsi_host_hn_get(unsigned short host_no)
 {
-	struct list_head *lh;
-	struct Scsi_Host *shost;
-
-	spin_lock(&scsi_host_list_lock);
-	list_for_each(lh, &scsi_host_list) {
-		shost = list_entry(lh, struct Scsi_Host, sh_list);
-		if (shost->host_no == host_no) {
-			/* XXX Inc ref count */
-			goto done;
-		}
-	}
-
-	shost = (struct Scsi_Host *)NULL;
-done:
-	spin_unlock(&scsi_host_list_lock);
-	return shost;
+	/* XXX Inc ref count */
+	return scsi_find_host_by_num(host_no);
 }
 
 /**
@@ -674,33 +635,10 @@
  **/
 void __init scsi_host_hn_init(char *shost_hn)
 {
-	char *temp = shost_hn;
-
-	while (temp) {
-		while (*temp && (*temp != ':') && (*temp != ','))
-			temp++;
-		if (!*temp)
-			temp = NULL;
-		else
-			*temp++ = 0;
-		(void)scsi_host_hn_add(shost_hn);
-		shost_hn = temp;
-	}
-}
-
-/**
- * scsi_host_no_release - free all entries in scsi host number list
- **/
-void __exit scsi_host_hn_release()
-{
-	struct list_head *lh, *next;
-	Scsi_Host_Name *shn;
-
-	list_for_each_safe(lh, next, &scsi_host_hn_list) {
-		shn = list_entry(lh, Scsi_Host_Name, shn_list);
-		if (shn->name)
-			kfree(shn->name);
-		kfree(shn);
+	scsihosts = shost_hn;
+	while (shost_hn) {
+		scsi_host_next_hn++;
+		shost_hn = strpbrk(shost_hn, ":,");
 	}
 }
 
--- 1.31/drivers/scsi/hosts.h	Mon Nov  4 23:07:50 2002
+++ edited/drivers/scsi/hosts.h	Tue Nov  5 23:07:07 2002
@@ -509,14 +509,6 @@
 extern void scsi_block_requests(struct Scsi_Host *);
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
 
-typedef struct SHN
-{
-	struct list_head shn_list;
-	char *name;
-	unsigned short host_no;
-	unsigned short host_registered;
-} Scsi_Host_Name;
-	
 extern void scsi_proc_host_mkdir(Scsi_Host_Template *);
 extern void scsi_proc_host_add(struct Scsi_Host *);
 extern void scsi_proc_host_rm(struct Scsi_Host *);
@@ -599,7 +591,6 @@
 extern struct Scsi_Host *scsi_host_hn_get(unsigned short);
 extern void scsi_host_put(struct Scsi_Host *);
 extern void scsi_host_hn_init(char *);
-extern void scsi_host_hn_release(void);
 
 /*
  * host_busy inc/dec/test functions
--- 1.54/drivers/scsi/scsi.c	Mon Nov  4 22:51:49 2002
+++ edited/drivers/scsi/scsi.c	Tue Nov  5 23:28:43 2002
@@ -2394,9 +2394,7 @@
 {
 	int i;
 
-        devfs_unregister (scsi_devfs_handle);
-
-	scsi_host_hn_release();
+	devfs_unregister (scsi_devfs_handle);
 
 #ifdef CONFIG_PROC_FS
 	/* No, we're not here anymore. Don't show the /proc/scsi files. */

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
@ 2002-11-06  0:51 Adam J. Richter
  2002-11-07 20:00 ` Patrick Mansfield
  0 siblings, 1 reply; 11+ messages in thread
From: Adam J. Richter @ 2002-11-06  0:51 UTC (permalink / raw)
  To: James.Bottomley; +Cc: hch, linux-scsi

	Although I haven't tested it, Christoph's version of my
patch to remove Scsi_Host_Name looks OK to me.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-05 23:54 ` Christoph Hellwig
@ 2002-11-07  1:13   ` Patrick Mansfield
  0 siblings, 0 replies; 11+ messages in thread
From: Patrick Mansfield @ 2002-11-07  1:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Adam J. Richter, James.Bottomley, linux-scsi

On Wed, Nov 06, 2002 at 12:54:20AM +0100, Christoph Hellwig wrote:
> On Tue, Nov 05, 2002 at 04:20:15AM -0800, Adam J. Richter wrote:

> Okay, here's a version with minimal cleanups (different placements of
> the functions, use of list_for_each_entry, etc..) against
> scsi-for-linus-2.5.  Patch looks fine to me, but I had no chance to
> actually test the boot argument.

I tried without a boot argument, and I get host number slippage on
rmmod/insmod (there are 3 bugs in sysfs, and one in scsi that break
rmmod - I'll try and post a hack patch).

scsihosts is always NULL in the following, so we never reuse any host
numbers. This does not match the previous behaviour (AFAIR), not that
I personally have a beef with this but I assume some users will want
their host numbers to be the same on rmmod/insmod (or hotplug?) of ans
adapter.

> +static int scsi_alloc_host_num(const char *name)
> +{
> +	int hostnum = 0;
> +
> +	if (name && scsihosts && scsihosts[0] != '\0') {
> +		const int namelen = strlen(name);
> +		const char *start, *end;
> +
> +		for (start = scsihosts; start; start = end, hostnum++) {
> +			int hostlen;
> +
> +			end = strpbrk(start, ",:");
> +			hostlen = end ? (end - start) : strlen(start);
> +
> +			if (hostlen != namelen)
> +				continue;
> +			if (strncmp(name, start, hostlen))
> +				continue;
> +			if (scsi_find_host_by_num(hostnum))
> +				continue;
> +			return hostnum;
> +		}
> +	}
> +
> +	return scsi_host_next_hn++;
> +}

-- Patrick Mansfield

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-06  0:51 Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list Adam J. Richter
@ 2002-11-07 20:00 ` Patrick Mansfield
  2002-11-10  3:13   ` Christoph Hellwig
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick Mansfield @ 2002-11-07 20:00 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: James.Bottomley, hch, linux-scsi

On Tue, Nov 05, 2002 at 04:51:56PM -0800, Adam J. Richter wrote:
> 	Although I haven't tested it, Christoph's version of my
> patch to remove Scsi_Host_Name looks OK to me.
> 

OK, I ran some more tests.

strpbrk() returns a pointer to the char searched for, so using
a command line like: 

	scsihosts=aic7xxx,ips,scsi_debug

Hangs in scsi_host_hn_init, as we keep getting a pointer back from
strpbrk() pointing to ",ips,scsi_debug". And a similiar problem with
scsi_alloc_host_num.

I fixed that, and added code in scsi_alloc_host_num to reuse empty
slots (if no match on scsihosts or scsihosts is empty).

But, there is no way to match the previous functionallity without having
a host name list.

That is before the patch we can do this:

	insmod foo; insmod bar

And foo gets scsi4, bar scsi5. And then:

	rmmod foo; rmmod bar
	insmod bar; insmod foo

And foo should still be scsi4, bar scsi5.

Without the host name list, the best we can do is have
foo become scsi5, and bar scsi4.

I think we should forget about this patch for now, and at some time in
the future after we have some device naming persistence drop the name
list and scsihosts option.

-- Patrick Mansfield

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-07 20:00 ` Patrick Mansfield
@ 2002-11-10  3:13   ` Christoph Hellwig
  0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2002-11-10  3:13 UTC (permalink / raw)
  To: Patrick Mansfield; +Cc: Adam J. Richter, James.Bottomley, hch, linux-scsi

On Thu, Nov 07, 2002 at 12:00:45PM -0800, Patrick Mansfield wrote:
> I fixed that, and added code in scsi_alloc_host_num to reuse empty
> slots (if no match on scsihosts or scsihosts is empty).
> 
> But, there is no way to match the previous functionallity without having
> a host name list.
> 
> That is before the patch we can do this:
> 
> 	insmod foo; insmod bar
> 
> And foo gets scsi4, bar scsi5. And then:
> 
> 	rmmod foo; rmmod bar
> 	insmod bar; insmod foo
> 
> And foo should still be scsi4, bar scsi5.
> 
> Without the host name list, the best we can do is have
> foo become scsi5, and bar scsi4.

Well, this is a behaviour change, but IMHO the old behaviour is bad.
> 
> I think we should forget about this patch for now, and at some time in
> the future after we have some device naming persistence drop the name
> list and scsihosts option.

I'd really like to get your fixed version of the patch in, no other
subsystem has similar strange hacks and I don't think the cruft is worth
that little gain.  People unsing that feature (are there any?  if yes
please explain what it buys you) might have a different opinion..


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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
@ 2002-11-10  5:37 Adam J. Richter
  2002-11-10 17:46 ` Patrick Mansfield
  0 siblings, 1 reply; 11+ messages in thread
From: Adam J. Richter @ 2002-11-10  5:37 UTC (permalink / raw)
  To: patmans; +Cc: hch, James.Bottomley, linux-scsi

Patrick Mansfield wrote:
>But, there is no way to match the previous functionallity without having
>a host name list.
>
>That is before the patch we can do this:
>
>        insmod foo; insmod bar
>
>And foo gets scsi4, bar scsi5. And then:
>
>        rmmod foo; rmmod bar
>        insmod bar; insmod foo
>
>And foo should still be scsi4, bar scsi5.
>
>Without the host name list, the best we can do is have
>foo become scsi5, and bar scsi4.

	I do not understand why you think these is any change
in behavior.

	If you passed "scsihosts=host1,host2,host3,foo,bar", then
you should the first foo controller will always be assigned ID 4,
and the first bar controller will always be assigned ID 5, no matter
how you load, unload and reload the foo and bar SCSI drivers.
A successful scsi_register always calls scsi_hostnum; scsi_hostname
always checks the scsihosts variable.

	If you disagree with this, please walk me through how the
second "insmod foo" gets scsi ID 4 when the scsihosts string has
reserved that ID for something else.  If you can actually produce
the behavior in real life, that would be even better.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Miplitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
@ 2002-11-10  5:40 Adam J. Richter
  0 siblings, 0 replies; 11+ messages in thread
From: Adam J. Richter @ 2002-11-10  5:40 UTC (permalink / raw)
  To: patmans; +Cc: hch, James.Bottomley, linux-scsi

Oops!  I wrote:
>        If you disagree with this, please walk me through how the
>second "insmod foo" gets scsi ID 4 when the scsihosts string has
                ^^^
>reserved that ID for something else.  If you can actually produce
>the behavior in real life, that would be even better.

        I meant the second "insmod bar".

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Miplitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America

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

* Re: Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list
  2002-11-10  5:37 Adam J. Richter
@ 2002-11-10 17:46 ` Patrick Mansfield
  0 siblings, 0 replies; 11+ messages in thread
From: Patrick Mansfield @ 2002-11-10 17:46 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: hch, James.Bottomley, linux-scsi

On Sat, Nov 09, 2002 at 09:37:46PM -0800, Adam J. Richter wrote:
> Patrick Mansfield wrote:
> >But, there is no way to match the previous functionallity without having
> >a host name list.
> >
> >That is before the patch we can do this:
> >
> >        insmod foo; insmod bar
> >
> >And foo gets scsi4, bar scsi5. And then:
> >
> >        rmmod foo; rmmod bar
> >        insmod bar; insmod foo
> >
> >And foo should still be scsi4, bar scsi5.
> >
> >Without the host name list, the best we can do is have
> >foo become scsi5, and bar scsi4.
> 
> 	I do not understand why you think these is any change
> in behavior.
> 
> 	If you passed "scsihosts=host1,host2,host3,foo,bar", then
> you should the first foo controller will always be assigned ID 4,
> and the first bar controller will always be assigned ID 5, no matter
> how you load, unload and reload the foo and bar SCSI drivers.
> A successful scsi_register always calls scsi_hostnum; scsi_hostname
> always checks the scsihosts variable.
> 
> 	If you disagree with this, please walk me through how the
> second "insmod foo" gets scsi ID 4 when the scsihosts string has
> reserved that ID for something else.  If you can actually produce
> the behavior in real life, that would be even better.

The scenario I outlined is for the case _without_ any "scsihosts=...".

But, you point out a simple way to get around this difference in
behaviour. If a user hits the problem I listed, they could just
boot with "scsihosts=foo,bar".

I'll rediff with ... one of the scsi trees and post a modified
patch.

-- Patrick Mansfield

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

end of thread, other threads:[~2002-11-10 17:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-06  0:51 Patch?: linux-2.5.45/drivers/scsi/hosts.[ch] - Eliminate scsi_host_tmpl_list Adam J. Richter
2002-11-07 20:00 ` Patrick Mansfield
2002-11-10  3:13   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2002-11-10  5:40 Adam J. Richter
2002-11-10  5:37 Adam J. Richter
2002-11-10 17:46 ` Patrick Mansfield
2002-11-05 12:20 Adam J. Richter
2002-11-05 22:58 ` Christoph Hellwig
2002-11-05 23:54 ` Christoph Hellwig
2002-11-07  1:13   ` Patrick Mansfield
2002-11-04 16:22 Adam J. Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).