]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] cciss: cylinder calculation fix
authorMike Miller <mike.miller@hp.com>
Mon, 23 Aug 2004 06:07:56 +0000 (23:07 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 23 Aug 2004 06:07:56 +0000 (23:07 -0700)
This patch fixes our cylinder calculations.  Without his fix the number of
cylinders maxes out at 65535.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/cciss.c

index 3e8dc2a5163721e6466074a8b0f75664eea28766..4e9e87ecb7b4685756f83bb2d81e59386c8eaf11 100644 (file)
@@ -1470,6 +1470,8 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
                        drv->sectors = 32; // Sectors per track
                        drv->cylinders = total_size / 255 / 32;
                } else {
+                       unsigned int t;
+
                        drv->block_size = block_size;
                        drv->nr_blocks = total_size;
                        drv->heads = inq_buff->data_byte[6];
@@ -1477,6 +1479,10 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
                        drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8;
                        drv->cylinders += inq_buff->data_byte[5];
                        drv->raid_level = inq_buff->data_byte[8];
+                       t = drv->heads * drv->sectors;
+                       if (t > 1) {
+                               drv->cylinders = total_size/t;
+                       }
                }
        } else { /* Get geometry failed */
                printk(KERN_WARNING "cciss: reading geometry failed, "