[5191] in linux-scsi channel archive
minor bug in linux/drivers/scsi/sd.c
daemon@ATHENA.MIT.EDU (Niki W. Waibel)
Sun Nov 22 03:19:02 1998
Date: Sat, 21 Nov 1998 23:09:38 +0100 (MET)
Reply-To: "Niki W. Waibel" <niki.waibel@gmx.net>
From: "Niki W. Waibel" <niki.waibel@gmx.net>
To: linux-scsi@vger.rutgers.edu
Cc: torvalds@transmeta.com
I use/test Linux kernel v2.0.33 / v2.1.129 / v2.1.128 / v2.1.125.
I've an Adaptec 2940 UW SCSI controller and a IBM DDRS-39130 conected to it.
The capacity of the DDRS-39130 is:
9.138.286.080 bytes
8.924.107,500 KB
8.714,949 MB
8,510 GB !!! (remember: 1024 instead of 1000) !!!
The SCSI driver sd.c (linux/drivers/scsi/sd.c) reports:
===cut===
SCSI device sda: hdwr sector= 512 bytes. Sectors= 17850000 [8715 MB] [8.7 GB]
===!cut===
-------------------------------------------------------> !!!!!!! !!!!!!
Printed by 'printk' in lines 1389-1392 of 'linux/drivers/scsi/sd.c'
(linux-2.1.129).
This seems not to be a major bug, but it would be nice to see the correct
values at kernel startup.
The
'sz_quot' 'sz_rem'
stuff seems to be wrong!
I've removed it from linux-2.1.129 and added corrected stuff. The following
'diff -u' should explain more:
===cut===
--- linux.orig/drivers/scsi/sd.c Thu Nov 19 22:56:48 1998
+++ linux/drivers/scsi/sd.c Thu Nov 19 23:02:01 1998
@@ -1378,7 +1378,6 @@
* Jacques Gelinas (Jacques@solucorp.qc.ca)
*/
int m, mb;
- int sz_quot, sz_rem;
int hard_sector = rscsi_disks[i].sector_size;
/* There are 16 minors allocated for each major device */
for (m=i<<4; m<((i+1)<<4); m++){
@@ -1387,12 +1386,10 @@
mb = rscsi_disks[i].capacity / 1024 * hard_sector / 1024;
/* sz = div(m/100, 10); this seems to not be in the libr */
m = (mb + 50) / 100;
- sz_quot = m / 10;
- sz_rem = m - (10 * sz_quot);
printk ("SCSI device %s: hdwr sector= %d bytes."
" Sectors= %d [%d MB] [%d.%1d GB]\n",
nbuff, hard_sector, rscsi_disks[i].capacity,
- mb, sz_quot, sz_rem);
+ mb, mb / 1024, (mb * 10 + 512) / 1024 % 10);
}
if(rscsi_disks[i].sector_size == 2048)
rscsi_disks[i].capacity <<= 2; /* Change into 512 byte sectors */
===!cut===
Hope that this helps and be included soon in one of the next kernel releases.
Regards, Niki
---
Niki W. Waibel
Author of TrueReality - a (GNU GPL) UNIX based N64 emulator
http://www.snes9x.com/n64emulators
---
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu