From: Tejun Heo Date: Thu, 10 Nov 2005 17:20:16 +0000 (+0100) Subject: [BLOCK] cfq-iosched: fix slice_left calculation X-Git-Tag: v2.6.15-rc2~225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b740d98f5614e34b4cff2e1e67826f007c8d4f30;p=platform%2Fkernel%2Flinux-3.10.git [BLOCK] cfq-iosched: fix slice_left calculation When cfq slice expires, remainder of slice is calculated and stored in cfqq->slice_left. Current code calculates the opposite of remainder - how many jiffies the cfqq has used past slice end. This patch fixes the bug. Signed-off-by: Tejun Heo Signed-off-by: Jens Axboe --- diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 4525386..2b64f58 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -861,8 +861,8 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, * store what was left of this slice, if the queue idled out * or was preempted */ - if (time_after(now, cfqq->slice_end)) - cfqq->slice_left = now - cfqq->slice_end; + if (time_after(cfqq->slice_end, now)) + cfqq->slice_left = cfqq->slice_end - now; else cfqq->slice_left = 0;