Skip to content

Commit

Permalink
block,cfq: change code order
Browse files Browse the repository at this point in the history
cfq_slice_expired will change saved_workload_slice. It should be called
first so saved_workload_slice is correctly set to 0 after workload type
is changed.
This fixes the code order changed by 54b466e.

Tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Shaohua Li authored and axboe committed Jan 19, 2012
1 parent 90a4c0f commit df0793a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3117,17 +3117,18 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
*/
static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{
enum wl_type_t old_type = cfqq_type(cfqd->active_queue);

cfq_log_cfqq(cfqd, cfqq, "preempt");
cfq_slice_expired(cfqd, 1);

/*
* workload type is changed, don't save slice, otherwise preempt
* doesn't happen
*/
if (cfqq_type(cfqd->active_queue) != cfqq_type(cfqq))
if (old_type != cfqq_type(cfqq))
cfqq->cfqg->saved_workload_slice = 0;

cfq_slice_expired(cfqd, 1);

/*
* Put the new queue at the front of the of the current list,
* so we know that it will be selected next.
Expand Down

0 comments on commit df0793a

Please sign in to comment.