diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2010-10-01 08:51:14 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-10-01 08:51:14 -0400 |
commit | 3aad5d3ee4e4fce8f4b5bb6ca73342dcade42b33 (patch) | |
tree | 1ba65d361b6d77761f53769fc8891a56085422c6 /block | |
parent | fe0714377ee2ca161bf2afb7773e22f15f1786d4 (diff) |
blkio-throttle: Fix link failure failure on i386
o Randy Dunlap reported following linux-next failure. This patch fixes it.
on i386:
blk-throttle.c:(.text+0x1abb8): undefined reference to `__udivdi3'
blk-throttle.c:(.text+0x1b1dc): undefined reference to `__udivdi3'
o bytes_per_second interface is 64bit and I was continuing to do 64 bit
division even on 32bit platform without help of special macros/functions
hence the failure.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-throttle.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 11713ed852f4..a46700255719 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -378,7 +378,8 @@ throtl_slice_used(struct throtl_data *td, struct throtl_grp *tg, bool rw) | |||
378 | static inline void | 378 | static inline void |
379 | throtl_trim_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) | 379 | throtl_trim_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) |
380 | { | 380 | { |
381 | unsigned long nr_slices, bytes_trim, time_elapsed, io_trim; | 381 | unsigned long nr_slices, time_elapsed, io_trim; |
382 | u64 bytes_trim, tmp; | ||
382 | 383 | ||
383 | BUG_ON(time_before(tg->slice_end[rw], tg->slice_start[rw])); | 384 | BUG_ON(time_before(tg->slice_end[rw], tg->slice_start[rw])); |
384 | 385 | ||
@@ -396,8 +397,10 @@ throtl_trim_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) | |||
396 | 397 | ||
397 | if (!nr_slices) | 398 | if (!nr_slices) |
398 | return; | 399 | return; |
400 | tmp = tg->bps[rw] * throtl_slice * nr_slices; | ||
401 | do_div(tmp, HZ); | ||
402 | bytes_trim = tmp; | ||
399 | 403 | ||
400 | bytes_trim = (tg->bps[rw] * throtl_slice * nr_slices)/HZ; | ||
401 | io_trim = (tg->iops[rw] * throtl_slice * nr_slices)/HZ; | 404 | io_trim = (tg->iops[rw] * throtl_slice * nr_slices)/HZ; |
402 | 405 | ||
403 | if (!bytes_trim && !io_trim) | 406 | if (!bytes_trim && !io_trim) |
@@ -415,7 +418,7 @@ throtl_trim_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) | |||
415 | 418 | ||
416 | tg->slice_start[rw] += nr_slices * throtl_slice; | 419 | tg->slice_start[rw] += nr_slices * throtl_slice; |
417 | 420 | ||
418 | throtl_log_tg(td, tg, "[%c] trim slice nr=%lu bytes=%lu io=%lu" | 421 | throtl_log_tg(td, tg, "[%c] trim slice nr=%lu bytes=%llu io=%lu" |
419 | " start=%lu end=%lu jiffies=%lu", | 422 | " start=%lu end=%lu jiffies=%lu", |
420 | rw == READ ? 'R' : 'W', nr_slices, bytes_trim, io_trim, | 423 | rw == READ ? 'R' : 'W', nr_slices, bytes_trim, io_trim, |
421 | tg->slice_start[rw], tg->slice_end[rw], jiffies); | 424 | tg->slice_start[rw], tg->slice_end[rw], jiffies); |
@@ -462,7 +465,7 @@ static bool tg_with_in_bps_limit(struct throtl_data *td, struct throtl_grp *tg, | |||
462 | struct bio *bio, unsigned long *wait) | 465 | struct bio *bio, unsigned long *wait) |
463 | { | 466 | { |
464 | bool rw = bio_data_dir(bio); | 467 | bool rw = bio_data_dir(bio); |
465 | u64 bytes_allowed, extra_bytes; | 468 | u64 bytes_allowed, extra_bytes, tmp; |
466 | unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; | 469 | unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; |
467 | 470 | ||
468 | jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; | 471 | jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; |
@@ -473,8 +476,9 @@ static bool tg_with_in_bps_limit(struct throtl_data *td, struct throtl_grp *tg, | |||
473 | 476 | ||
474 | jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, throtl_slice); | 477 | jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, throtl_slice); |
475 | 478 | ||
476 | bytes_allowed = (tg->bps[rw] * jiffies_to_msecs(jiffy_elapsed_rnd)) | 479 | tmp = tg->bps[rw] * jiffies_to_msecs(jiffy_elapsed_rnd); |
477 | / MSEC_PER_SEC; | 480 | do_div(tmp, MSEC_PER_SEC); |
481 | bytes_allowed = tmp; | ||
478 | 482 | ||
479 | if (tg->bytes_disp[rw] + bio->bi_size <= bytes_allowed) { | 483 | if (tg->bytes_disp[rw] + bio->bi_size <= bytes_allowed) { |
480 | if (wait) | 484 | if (wait) |