Re: cciss updates for 2.6 [9 of 11]

From: Andrew Morton
Date: Thu Feb 05 2004 - 00:24:22 EST


mikem@xxxxxxxxxxxxxxxxxxxxxxx wrote:
>
> + vol_sz = drv->nr_blocks/ENG_GIG_FACTOR;
> + vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;

This causes problems with CONFIG_LBD=y on ia32.

drivers/built-in.o: In function `cciss_proc_get_info':
/tmp/distcc_1108/drivers/block/cciss.c:217: undefined reference to `__udivdi3'
/tmp/distcc_1108/drivers/block/cciss.c:218: undefined reference to `__umoddi3'
/tmp/distcc_1108/drivers/block/cciss.c:218: undefined reference to `__udivdi3'

I'll include the below fix - could you please test it? With both
CONFIG_LBD=y and CONFIG_LBD=n?

Thanks.


diff -puN drivers/block/cciss.c~cciss-64-bit-divide-fix drivers/block/cciss.c
--- 25/drivers/block/cciss.c~cciss-64-bit-divide-fix 2004-02-04 21:15:48.000000000 -0800
+++ 25-akpm/drivers/block/cciss.c 2004-02-04 21:15:48.000000000 -0800
@@ -211,11 +211,27 @@ 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/ENG_GIG_FACTOR;
- vol_sz_frac = (drv->nr_blocks%ENG_GIG_FACTOR)*100/ENG_GIG_FACTOR;
+ 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_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:"

_

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