From 920b721b3b70dfa7ac871bfa26c0d748346b1c3e Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Sun, 22 Aug 2004 23:07:56 -0700 Subject: [PATCH] [PATCH] cciss: cylinder calculation fix This patch fixes our cylinder calculations. Without his fix the number of cylinders maxes out at 65535. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/cciss.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 3e8dc2a516372..4e9e87ecb7b46 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -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, " -- 2.53.0