lkml.org 
[lkml]   [2004]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subjectcciss update [3 of 6]
Date
From
Patch 3 of 6
Name: p003_proc_fixes_for_268rc2.patch

This patch fixes our calculations for volume size displayed in /proc. There was some
truncation going on that resulted in volume sizes of 0. Also changed GB to 1000^3.
That's the value disk makers use.
Also fixes the RAID level display.
Please consider this for inclusion. Patch applies to 2.6.8-rc2.
Please apply patches in order.

Thanks,
mikem
-------------------------------------------------------------------------------------
diff -burpN lx268-rc2-p002/drivers/block/cciss.c lx268-rc2-p003/drivers/block/cciss.c
--- lx268-rc2-p002/drivers/block/cciss.c 2004-07-30 11:19:33.000000000 -0500
+++ lx268-rc2-p003/drivers/block/cciss.c 2004-08-04 11:29:45.796928760 -0500
@@ -191,10 +191,10 @@ static inline CommandList_struct *remove
/*
* Report information about this controller.
*/
-#define ENG_GIG 1048576000
+#define ENG_GIG 1000000000
#define ENG_GIG_FACTOR (ENG_GIG/512)
#define RAID_UNKNOWN 6
-static const char *raid_label[] = {"0","4","1(0+1)","5","5+1","ADG",
+static const char *raid_label[] = {"0","4","1(1+0)","5","5+1","ADG",
"UNKNOWN"};

static struct proc_dir_entry *proc_cciss;
@@ -208,7 +208,7 @@ static int cciss_proc_get_info(char *buf
ctlr_info_t *h = (ctlr_info_t*)data;
drive_info_struct *drv;
unsigned long flags;
- unsigned int vol_sz, vol_sz_frac;
+ sector_t vol_sz, vol_sz_frac;

ctlr = h->ctlr;

@@ -245,32 +245,21 @@ static int cciss_proc_get_info(char *buf
pos += size; len += size;
cciss_proc_tape_report(ctlr, buffer, &pos, &len);
for(i=0; i<=h->highest_lun; i++) {
- sector_t tmp;

drv = &h->drv[i];
if (drv->block_size == 0)
continue;
- vol_sz = drv->nr_blocks;
- sector_div(vol_sz, ENG_GIG_FACTOR);
-
- /*
- * Awkwardly do this:
- * vol_sz_frac =
- * (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;
- */
- tmp = drv->nr_blocks;
- vol_sz_frac = sector_div(tmp, ENG_GIG_FACTOR);
-
- /* Now, vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR) */

+ vol_sz = drv->nr_blocks;
+ vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR);
vol_sz_frac *= 100;
sector_div(vol_sz_frac, ENG_GIG_FACTOR);

if (drv->raid_level > 5)
drv->raid_level = RAID_UNKNOWN;
size = sprintf(buffer+len, "cciss/c%dd%d:"
- "\t%4d.%02dGB\tRAID %s\n",
- ctlr, i, vol_sz,vol_sz_frac,
+ "\t%4u.%02uGB\tRAID %s\n",
+ ctlr, i, (int)vol_sz, (int)vol_sz_frac,
raid_label[drv->raid_level]);
pos += size; len += size;
}
@@ -1489,6 +1478,7 @@ static void cciss_geometry_inquiry(int c
drv->sectors = inq_buff->data_byte[7];
drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8;
drv->cylinders += inq_buff->data_byte[5];
+ drv->raid_level = inq_buff->data_byte[8];
}
} else { /* Get geometry failed */
printk(KERN_WARNING "cciss: reading geometry failed, "
m
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.033 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site