summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/blk-iocost.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 58ad4e5b2fff..a4f195685c3c 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -868,9 +868,14 @@ static void calc_lcoefs(u64 bps, u64 seqiops, u64 randiops,
*page = *seqio = *randio = 0;
- if (bps)
- *page = DIV64_U64_ROUND_UP(VTIME_PER_SEC,
- DIV_ROUND_UP_ULL(bps, IOC_PAGE_SIZE));
+ if (bps) {
+ u64 bps_pages = DIV_ROUND_UP_ULL(bps, IOC_PAGE_SIZE);
+
+ if (bps_pages)
+ *page = DIV64_U64_ROUND_UP(VTIME_PER_SEC, bps_pages);
+ else
+ *page = 1;
+ }
if (seqiops) {
v = DIV64_U64_ROUND_UP(VTIME_PER_SEC, seqiops);