summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2005-07-15 03:56:27 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-15 09:54:50 -0700
commit1eb29128c644581fa51f822545921394ad4f719f (patch)
tree936f6c517e2d8acd927a0b9e30ab07ed8b9ae58f /drivers/md
parent030babac6ae54df64ae3bba4685ecb1d8d8dd8c3 (diff)
downloadlinux-1eb29128c644581fa51f822545921394ad4f719f.tar.gz
linux-1eb29128c644581fa51f822545921394ad4f719f.tar.bz2
linux-1eb29128c644581fa51f822545921394ad4f719f.zip
[PATCH] Fix raid0's attempt to divide by 64bit numbers
Apparently sector_div is only guaranteed to work with a 32bit divisor, even on 64bit architectures. So allow for this in raid0. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid0.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index e11dd14d0b43..2120710172c5 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -314,16 +314,16 @@ static int raid0_run (mddev_t *mddev)
sector_t space = conf->hash_spacing;
int round;
conf->preshift = 0;
- if (sizeof(sector_t) > sizeof(unsigned long)) {
+ if (sizeof(sector_t) > sizeof(u32)) {
/*shift down space and s so that sector_div will work */
- while (space > (sector_t) (~(unsigned long)0)) {
+ while (space > (sector_t) (~(u32)0)) {
s >>= 1;
space >>= 1;
s += 1; /* force round-up */
conf->preshift++;
}
}
- round = sector_div(s, (unsigned long)space) ? 1 : 0;
+ round = sector_div(s, (u32)space) ? 1 : 0;
nb_zone = s + round;
}
printk("raid0 : nb_zone is %d.\n", nb_zone);
@@ -443,7 +443,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
volatile
#endif
sector_t x = block >> conf->preshift;
- sector_div(x, (unsigned long)conf->hash_spacing);
+ sector_div(x, (u32)conf->hash_spacing);
zone = conf->hash_table[x];
}