public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Badari Pulavarty <pbadari@us.ibm.com>
To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: Andrew Morton <akpm@digeo.com>
Subject: [patch for playing] 2.5.65 patch to support > 256 disks
Date: Fri, 21 Mar 2003 10:56:04 -0800	[thread overview]
Message-ID: <200303211056.04060.pbadari@us.ibm.com> (raw)

[-- 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);
 

             reply	other threads:[~2003-03-21 18:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21 18:56 Badari Pulavarty [this message]
2003-03-22 11:00 ` [patch for playing] 2.5.65 patch to support > 256 disks 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200303211056.04060.pbadari@us.ibm.com \
    --to=pbadari@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox