All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: Patch - SCSI host numbers - please apply
@ 2002-06-06 10:23 Itai Nahshon
  2002-06-12 21:59 ` Marcelo Tosatti
  0 siblings, 1 reply; 5+ messages in thread
From: Itai Nahshon @ 2002-06-06 10:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

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

This was sent on Apr 22 and probably lost.
This patch still applies cleanly to 2.4.19-pre10.

Can this get in the kernel before 2.4.19 final ?

-- Itai

----------  Forwarded Message  ----------

Subject: Patch - SCSI host numbers - please apply
Date: Mon, 22 Apr 2002 09:19:56 +0300
From: Itai Nahshon <nahshon@actcom.co.il>
To: Marcelo Tosatti <marcelo@conectiva.com.br>, Jens Axboe <axboe@suse.de>

Hello,
I think this has gone through enough testing...

History:
  A similar patch was submitted to to lkml and to linux-scsi
  two months ago. Verified by Aron Zeh <ARZEH@de.ibm.com> on Apr 9.
  The attached patch is a cleaned-up version
  (The original had #ifdef'ed the code that this one removes).

Kernel version info:
  2.4.x: Patch applies cleanly (and tested with) all 2.4.19-preX
        kernels.
  2.5.x: Patch applies with 8 line offset to 2.5.8.
        Bug verified only by "visual inspection". (but really nothing
	in the host_no allocation algorithm has changed since 2.4).

Bug info:
  Actually fixing two _different_ scenarios that look almost the same.
  Need two or more) scsi host adapters that are not required for
  normal system usage. I uses ide-scsi and usb-storage fr my
  tests. Start with a "clean system" (before any of these drivers
  is loaded). Suppose scsi host adapter drivers are named A and B.

  scenario 1:
	insmod A
	rmmod A
	insmod A
	insmod B

  scenario 2:
	insmod A
	rmmod A
	insmod B
	insmod A

  Without the patch, both scenarios end with both host adapters having
  the same host_no.

More tests:
  I tested also with param scsihosts=<host0>:<host1>:....
  (when loading scsi_mod)

Comment/motivation:
  This keeps max_scsi_host coherent with the length of the list
  scsi_host_no_list. Since we never shorten the list
  we should never decrement max_scsi_host.

Sincerely,
-- Itai

-------------------------------------------------------


[-- Attachment #2: scsi-host_no_fix.patch --]
[-- Type: text/x-diff, Size: 1130 bytes --]

--- drivers/scsi/hosts.c.orig	Mon Feb 25 21:38:04 2002
+++ drivers/scsi/hosts.c	Wed Apr 17 01:42:47 2002
@@ -81,8 +81,8 @@
 struct Scsi_Host * scsi_hostlist;
 struct Scsi_Device_Template * scsi_devicelist;
 
-int max_scsi_hosts;
-int next_scsi_host;
+int max_scsi_hosts;	/* host_no for next new host */
+int next_scsi_host;	/* count of registered scsi hosts */
 
 void
 scsi_unregister(struct Scsi_Host * sh){
@@ -107,21 +107,8 @@
     if (shn) shn->host_registered = 0;
     /* else {} : This should not happen, we should panic here... */
     
-    /* If we are removing the last host registered, it is safe to reuse
-     * its host number (this avoids "holes" at boot time) (DB) 
-     * It is also safe to reuse those of numbers directly below which have
-     * been released earlier (to avoid some holes in numbering).
-     */
-    if(sh->host_no == max_scsi_hosts - 1) {
-	while(--max_scsi_hosts >= next_scsi_host) {
-	    shpnt = scsi_hostlist;
-	    while(shpnt && shpnt->host_no != max_scsi_hosts - 1)
-		shpnt = shpnt->next;
-	    if(shpnt)
-		break;
-	}
-    }
     next_scsi_host--;
+
     kfree((char *) sh);
 }
 

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

end of thread, other threads:[~2002-06-19 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200206171604.57115.nahshon@actcom.co.il>
     [not found] ` <3D0E4F4F.1D3D68B3@splentec.com>
     [not found]   ` <200206181514.52827.nahshon@actcom.co.il>
2002-06-18 21:18     ` Fwd: Patch - SCSI host numbers - please apply Luben Tuikov
2002-06-19  0:03       ` Itai Nahshon
2002-06-19 16:26         ` Luben Tuikov
2002-06-06 10:23 Itai Nahshon
2002-06-12 21:59 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.