Skip to content

Commit

Permalink
[BLOCK] cfq-iosched: fix slice_left calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Nov 12, 2005
1 parent be56123 commit b740d98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b740d98

Please sign in to comment.