public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: linux kernel <linux-kernel@vger.kernel.org>
Subject: PATCH: Support tera byte disk
Date: Wed, 18 Sep 2002 13:11:20 -0700	[thread overview]
Message-ID: <20020918131120.A5120@lucon.org> (raw)

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

For a 1.8TB SCSI HD, kernel reports:

SCSI device sda: -773086208 512-byte hdwr sectors (-395819 MB)

Here is a patch to fix it. BTW, I don't think it will work with > 2TB,
which requires bigger changes.


H.J.

[-- Attachment #2: linux-2.4.18-tera.patch --]
[-- Type: text/plain, Size: 1155 bytes --]

--- linux-2.4.18-14.2/drivers/scsi/sd.c.tera	Wed Sep 18 11:55:53 2002
+++ linux-2.4.18-14.2/drivers/scsi/sd.c	Wed Sep 18 12:42:36 2002
@@ -1018,8 +1018,16 @@ static int sd_init_onedisk(int i)
 			 * Jacques Gelinas (Jacques@solucorp.qc.ca)
 			 */
 			int m;
-			int hard_sector = sector_size;
-			int sz = rscsi_disks[i].capacity * (hard_sector/256);
+			unsigned hard_sector = sector_size;
+			unsigned sz = rscsi_disks[i].capacity * (hard_sector/256);
+
+			/* Check for overflow.  */
+			if (sz < rscsi_disks[i].capacity) {
+				sz = (rscsi_disks[i].capacity/1950) * (hard_sector/256);
+				sz = sz/2 - sz/1250 + 974;
+			}
+			else
+				sz = (sz/2 - sz/1250 + 974)/1950;
 
 			/* There are 16 minors allocated for each major device */
 			for (m = i << 4; m < ((i + 1) << 4); m++) {
@@ -1027,9 +1035,9 @@ static int sd_init_onedisk(int i)
 			}
 
 			printk("SCSI device %s: "
-			       "%d %d-byte hdwr sectors (%d MB)\n",
+			       "%u %u-byte hdwr sectors (%u MB)\n",
 			       nbuff, rscsi_disks[i].capacity,
-			       hard_sector, (sz/2 - sz/1250 + 974)/1950);
+			       hard_sector, sz);
 		}
 
 		/* Rescale capacity to 512-byte units */

             reply	other threads:[~2002-09-18 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-18 20:11 H. J. Lu [this message]
2002-09-18 20:32 ` PATCH: Support tera byte disk Andreas Dilger
2002-09-18 22:23   ` Bryan O'Sullivan
2002-09-18 22:41     ` Andreas Dilger
2002-09-19 10:33       ` Mike Black

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=20020918131120.A5120@lucon.org \
    --to=hjl@lucon.org \
    --cc=linux-kernel@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