projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0956264
)
backend: fix potential divide-by-zero
author
Jens Axboe
<axboe@fb.com>
Mon, 14 Apr 2014 15:51:10 +0000
(09:51 -0600)
committer
Jens Axboe
<axboe@fb.com>
Mon, 14 Apr 2014 15:51:10 +0000
(09:51 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
patch
|
blob
|
blame
|
history
diff --git
a/backend.c
b/backend.c
index b05e5437705ccf7cb4957b9c656a84cd76eaaa11..c1c8f96774850a755681dffa710d0ee1550fe16b 100644
(file)
--- a/
backend.c
+++ b/
backend.c
@@
-182,7
+182,11
@@
static int __check_min_rate(struct thread_data *td, struct timeval *now,
ratemin);
return 1;
} else {
- rate = ((bytes - td->rate_bytes[ddir]) * 1000) / spent;
+ if (spent)
+ rate = ((bytes - td->rate_bytes[ddir]) * 1000) / spent;
+ else
+ rate = 0;
+
if (rate < ratemin ||
bytes < td->rate_bytes[ddir]) {
log_err("%s: min rate %u not met, got"