linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch for playing] 2.5.65 patch to support > 256 disks
@ 2003-03-21 18:56 Badari Pulavarty
  2003-03-22 11:00 ` Douglas Gilbert
  0 siblings, 1 reply; 22+ messages in thread
From: Badari Pulavarty @ 2003-03-21 18:56 UTC (permalink / raw)
  To: linux-kernel, linux-scsi; +Cc: Andrew Morton

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

Hi,

Andries Brouwer recently submitted 32 bit dev_t patches,
which are in 2.5.65-mm2. This patch applies on those patches to support 
more than 256 disks.  This is for playing only.

I tested this with 4000 disks using scsi_debug. I attached my actual
disks (50) after 4000 scsi_debug disks. I am able to access my disks
fine and do IO on them.

Problems (so far):

1) sd.c -  sd_index_bits[] arrys became big - need to be fixed.

2) 4000 disks eats up lots of low memory (~460 MB). Here is the
/proc/meminfo output before & after insmod.

Before:
MemTotal:      3883276 kB
MemFree:       3808028 kB
Buffers:          3240 kB
Cached:          41860 kB
SwapCached:          0 kB
Active:          45360 kB
Inactive:         7288 kB
HighTotal:     3014616 kB
HighFree:      2961856 kB
LowTotal:       868660 kB
LowFree:        846172 kB
SwapTotal:     2040244 kB
SwapFree:      2040244 kB
Dirty:             192 kB
Writeback:           0 kB
Mapped:          14916 kB
Slab:             7164 kB
Committed_AS:    12952 kB
PageTables:        312 kB
ReverseMaps:      1895
====
After:
MemTotal:      3883276 kB
MemFree:       3224140 kB
Buffers:          3880 kB
Cached:         140376 kB
SwapCached:          0 kB
Active:          47512 kB
Inactive:       105508 kB
HighTotal:     3014616 kB
HighFree:      2838144 kB
LowTotal:       868660 kB
LowFree:        385996 kB
SwapTotal:     2040244 kB
SwapFree:      2040244 kB
Dirty:              92 kB
Writeback:           0 kB
Mapped:          16172 kB
Slab:           464364 kB
Committed_AS:    14996 kB
PageTables:        412 kB
ReverseMaps:      2209

[-- Attachment #2: sd.patch --]
[-- Type: text/x-diff, Size: 1353 bytes --]

--- linux/drivers/scsi/sd.c	Thu Mar 20 15:06:00 2003
+++ linux.new/drivers/scsi/sd.c	Fri Mar 21 11:50:54 2003
@@ -56,7 +56,9 @@
  * Remaining dev_t-handling stuff
  */
 #define SD_MAJORS	16
-#define SD_DISKS	(SD_MAJORS << 4)
+#define SD_DISKS_PER_MAJOR_SHIFT	(KDEV_MINOR_BITS - 4)
+#define SD_DISKS_PER_MAJOR	(1 << SD_DISKS_PER_MAJOR_SHIFT)
+#define SD_DISKS	(SD_MAJORS << SD_DISKS_PER_MAJOR_SHIFT)
 
 /*
  * Time out in seconds for disks and Magneto-opticals (which are slower).
@@ -1328,17 +1330,23 @@ static int sd_attach(struct scsi_device 
 	sdkp->index = index;
 
 	gd->de = sdp->de;
-	gd->major = sd_major(index >> 4);
-	gd->first_minor = (index & 15) << 4;
+	gd->major = sd_major(index >> SD_DISKS_PER_MAJOR_SHIFT);
+	gd->first_minor = (index & (SD_DISKS_PER_MAJOR - 1)) << 4;
 	gd->minors = 16;
 	gd->fops = &sd_fops;
 
-	if (index >= 26) {
+	if (index < 26) {
+		sprintf(gd->disk_name, "sd%c", 'a' + index % 26);
+	} else if (index < (26*27)) {
 		sprintf(gd->disk_name, "sd%c%c",
 			'a' + index/26-1,'a' + index % 26);
 	} else {
-		sprintf(gd->disk_name, "sd%c", 'a' + index % 26);
-	}
+		const unsigned int m1 = (index/ 26 - 1) / 26 - 1;
+		const unsigned int m2 = (index / 26 - 1) % 26;
+		const unsigned int m3 = index % 26;
+		sprintf(gd->disk_name, "sd%c%c%c", 
+			'a' + m1, 'a' + m2, 'a' + m3);
+	}	
 
 	sd_init_onedisk(sdkp, gd);
 

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

end of thread, other threads:[~2003-03-29  1:30 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 18:56 [patch for playing] 2.5.65 patch to support > 256 disks Badari Pulavarty
2003-03-22 11:00 ` Douglas Gilbert
2003-03-22 11:04   ` Andrew Morton
2003-03-22 11:46     ` Douglas Gilbert
2003-03-22 12:05       ` Andrew Morton
2003-03-24 21:32         ` Badari Pulavarty
2003-03-24 22:22           ` Douglas Gilbert
2003-03-24 22:54             ` Badari Pulavarty
2003-03-25  0:10           ` Andrew Morton
2003-03-24 22:57             ` Badari Pulavarty
2003-03-25 10:56         ` Jens Axboe
2003-03-25 11:23           ` Jens Axboe
2003-03-25 11:37             ` Jens Axboe
2003-03-25 11:39           ` Nick Piggin
2003-03-25 12:01             ` Jens Axboe
2003-03-25 12:12               ` Nick Piggin
2003-03-25 12:35                 ` Jens Axboe
2003-03-27  0:29                   ` Badari Pulavarty
2003-03-27  9:18                     ` Jens Axboe
2003-03-28 17:04                       ` Badari Pulavarty
2003-03-28 18:41                         ` Andries Brouwer
2003-03-29  1:39                           ` Badari Pulavarty

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).