patch for sd.c: fix MB vs. GB

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Thu, 24 Dec 1998 15:55:39 +0100


Hi,

now that 2.2.0 is approaching I'd like to get this one really to be fixed
(I first tried it in April 1996 and the patch below is still applies correctly!).

the output for my disk

SCSI device sda: hdwr sector= 512 bytes. Sectors= 8399520 [4101 MB] [4.1 GB]
^^^^^^^ ^^^^^^
is just wrong, because

4101 MB / 1024 == 4.00488 GB

which is _not_ 4.1 GB !!!

----- Forwarded message from Harald Koenig <koenig@tat.physik.uni-tuebingen.de> -----

>From koenig Thu Apr 18 20:11:43 1996
From: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)
Subject: MB vs. GB
To: Linus.Torvalds@Helsinki.FI (Linus Torvalds)
Date: Thu, 18 Apr 1996 10:21:41 +0200 (MET DST)
Cc: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)

Hi Linus,

I like the new disk size message in sd.c but why is 1GB == 1000MB 1000* 2^20
and not 1GB == 1024MB == 2^30 ?

I'd really like to see "real" GBs as 2^30 (which would be more consistent
but just the opposite from what all the disk vendors thing a GB is
(or should be ;-))

Harald
-------------------------------------------------------------------------------
--- /soft/linux/drivers/scsi/sd.c Wed Apr 17 10:51:59 1996
+++ linux/drivers/scsi/sd.c Thu Apr 18 10:16:45 1996
@@ -1170,7 +1170,7 @@
}
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;
+ m = (mb*1000 + 51200) / 1024 / 100 ;
sz_quot = m / 10;
sz_rem = m - (10 * sz_quot);
printk ("SCSI device sd%c: hdwr sector= %d bytes."

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

----- End forwarded message -----

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/