summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/cfq-iosched.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c1adbd01d0fa..2d03004dc77c 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -4243,7 +4243,16 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
cfqq_type(cfqq));
st->ttime.last_end_request = now;
- if (!(rq->start_time + cfqd->cfq_fifo_expire[1] > now))
+ /*
+ * We have to do this check in jiffies since start_time is in
+ * jiffies and it is not trivial to convert to ns. If
+ * cfq_fifo_expire[1] ever comes close to 1 jiffie, this test
+ * will become problematic but so far we are fine (the default
+ * is 128 ms).
+ */
+ if (!time_after(rq->start_time +
+ nsecs_to_jiffies(cfqd->cfq_fifo_expire[1]),
+ jiffies))
cfqd->last_delayed_sync = now;
}