]> err.no Git - linux-2.6/commitdiff
[BLOCK] cfq-iosched: fix slice_left calculation
authorTejun Heo <htejun@gmail.com>
Thu, 10 Nov 2005 17:20:16 +0000 (18:20 +0100)
committerJens Axboe <axboe@nelson.home.kernel.dk>
Sat, 12 Nov 2005 09:56:36 +0000 (10:56 +0100)
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 <htejun@gmail.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
block/cfq-iosched.c

index 452538644bceaee55def80c3ae3f856a6c65da16..2b64f5852bfd7bb64afe6317d8df72d300c6a6e9 100644 (file)
@@ -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;