Skip to contentSkip to conversation

using 2 TB in real life

DISCUSSION [email protected] 2 participants 2 messages Dec 12, 2002 – Dec 13, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

SCSI device sdb: -320126976 512-byte hdwr sectors (-163904 MB)

Yes, the code in 2.4.20 works up to 30 bits.
A slight modification works up to 31 bits.
[This is cosmetic only.]

Andries

sd.c renamed from linux/2.4/linux-2.4.20/linux/drivers/scsi/sd.c +3 -3
@@ -1001,7 +1001,7 @@
 			 */
 			int m;
 			int hard_sector = sector_size;
-			int sz = rscsi_disks[i].capacity * (hard_sector/256);
+			unsigned int sz = (rscsi_disks[i].capacity/2) * (hard_sector/256);
 
 			/* There are 16 minors allocated for each major device */
 			for (m = i << 4; m < ((i + 1) << 4); m++) {
@@ -1009,9 +1009,9 @@
 			}
 
 			printk("SCSI device %s: "
-			       "%d %d-byte hdwr sectors (%d MB)\n",
+			       "%u %d-byte hdwr sectors (%d MB)\n",
 			       nbuff, rscsi_disks[i].capacity,
-			       hard_sector, (sz/2 - sz/1250 + 974)/1950);
+			       hard_sector, (sz - sz/625 + 974)/1950);
 		}
 
 		/* Rescale capacity to 512-byte units */
#1 lore raw
Quoted 4 lines · On December 13th 2002, [email protected] wrote:
Quoted 1 line

SCSI device sdb: -320126976 512-byte hdwr sectors (-163904 MB)

Yes, the code in 2.4.20 works up to 30 bits.
A slight modification works up to 31 bits.

It works up to less than 30 bits - a 0.9 TB Device shows up as

SCSI device sdb: 1806745600 512-byte hdwr sectors (-174457 MB)

while a 480 GB Device (correctly) shows up this way:

SCSI device sda: 961818624 512-byte hdwr sectors (492451 MB)

At 0.5 TB (29 bits) the first problem occurs: negative size. At 1 T (30 bits), the sector count also becomes negative.

Your patch (thank you!) does fix both problems and up to 1.9 TB, everything works as expected:

SCSI device sdb: 3974840320 512-byte hdwr sectors (2035118 MB)

Yes, it's purely cosmetical, but should be included in the main tree.

Regards,

Anders

Signature · 1 line
http://sysiphus.de