lkml.org 
[lkml]   [1996]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: SCSI patches for 1.3.86

> From: hjl@lucon.org@INTERNET on Sat, Apr 13, 1996 4:38 AM
> Subject: SCSI patches for 1.3.86
>
> X-Mailer: ELM [version 2.4 PL24]
> Content-Type: text
> Precedence: bulk
>
> Hi,
>
> Here are the revised SCSI HD capacity patch plus a patch for
> Nakamichi MBR-7 CDROM changer. They are for 1.3.86.
> H.J. Lu (hjl@gnu.ai.mit.edu)
> ---
> RCS file: /home/cvs/linux/linux/drivers/scsi/sd.c,v
> retrieving revision 1.1.1.11
> diff -c -r1.1.1.11 sd.c
> *** sd.c 1996/04/11 05:46:39 1.1.1.11
> --- sd.c 1996/04/12 14:30:11
> ***************
> *** 1161,1174 ****
> * So I have created this table. See ll_rw_blk.c
> * 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++){
> sd_hardsizes[m] = hard_sector;
> }
> ! mb = (hard_sector * rscsi_disks[i].capacity) / (1024*1024);
> /* sz = div(m/100, 10); this seems to not be in the libr */
> m = (mb + 50) / 100;
> sz_quot = m / 10;
> --- 1161,1187 ----
> * So I have created this table. See ll_rw_blk.c
> * Jacques Gelinas (Jacques@solucorp.qc.ca)
> */
> ! int m, mb, one_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++){
> sd_hardsizes[m] = hard_sector;
> }
> ! /*
> ! * mb = (hard_sector * rscsi_disks[i].capacity) / (1024*1024);
> ! *
> ! * hard_sector * rscsi_disks[i].capacity may be overflow.
> ! * We should be very careful. 1 MB is 1 << 20.
> ! * H.J. (hjl@lucon.org).
> ! */
> ! one_mb = 20;
> ! for (mb = hard_sector; (mb & 0x1) == 0 && one_mb > 0;
> ! mb >>= 1, one_mb--);
> ! for (m = rscsi_disks[i].capacity; (m & 0x1) == 0 && one_mb > 0;
> ! m >>= 1, one_mb--);
> ! mb *= m;
> ! mb >>= one_mb;
> /* sz = div(m/100, 10); this seems to not be in the libr */
> m = (mb + 50) / 100;
> sz_quot = m / 10;
>

Actually, this "fix" is too involved. Last week, somebody recommended just
re-ordering my original code thusly:
mb = (rscsi_disks[i].capacity /1024) * hard_sector/ 1024;

I think this is the best fix. It works fine for disks over 1MB and smaller
than 2097GB. And there aren't any SCSI disks < 1MB (that I am aware of),
and as for > 2097GB--- I'll worry about that when the time comes!
Regards,
Ray

\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.140 / U:0.088 seconds]
©2003-2011 Jasper Spaans. Advertise on this site