Skip to content

Commit

Permalink
cfq-iosched: minor cleanups
Browse files Browse the repository at this point in the history
* Some were accessing cic->cfqq[] directly.  Always use cic_to_cfqq()
  and cic_set_cfqq().

* check_ioprio_changed() doesn't need to verify cfq_get_queue()'s
  return for NULL.  It's always non-NULL.  Simplify accordingly.

This patch doesn't cause any functional changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
htejun authored and sultanqasim committed Feb 6, 2016
1 parent 6e560d7 commit 6769e3f
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3426,14 +3426,14 @@ static void cfq_exit_icq(struct io_cq *icq)
struct cfq_io_cq *cic = icq_to_cic(icq);
struct cfq_data *cfqd = cic_to_cfqd(cic);

if (cic->cfqq[BLK_RW_ASYNC]) {
cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_ASYNC]);
cic->cfqq[BLK_RW_ASYNC] = NULL;
if (cic_to_cfqq(cic, false)) {
cfq_exit_cfqq(cfqd, cic_to_cfqq(cic, false));
cic_set_cfqq(cic, NULL, false);
}

if (cic->cfqq[BLK_RW_SYNC]) {
cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_SYNC]);
cic->cfqq[BLK_RW_SYNC] = NULL;
if (cic_to_cfqq(cic, true)) {
cfq_exit_cfqq(cfqd, cic_to_cfqq(cic, true));
cic_set_cfqq(cic, NULL, true);
}
}

Expand Down Expand Up @@ -3492,18 +3492,14 @@ static void check_ioprio_changed(struct cfq_io_cq *cic, struct bio *bio)
if (unlikely(!cfqd) || likely(cic->ioprio == ioprio))
return;

cfqq = cic->cfqq[BLK_RW_ASYNC];
cfqq = cic_to_cfqq(cic, false);
if (cfqq) {
struct cfq_queue *new_cfqq;
new_cfqq = cfq_get_queue(cfqd, BLK_RW_ASYNC, cic, bio,
GFP_ATOMIC);
if (new_cfqq) {
cic->cfqq[BLK_RW_ASYNC] = new_cfqq;
cfq_put_queue(cfqq);
}
cfq_put_queue(cfqq);
cfqq = cfq_get_queue(cfqd, BLK_RW_ASYNC, cic, bio, GFP_ATOMIC);
cic_set_cfqq(cic, cfqq, false);
}

cfqq = cic->cfqq[BLK_RW_SYNC];
cfqq = cic_to_cfqq(cic, true);
if (cfqq)
cfq_mark_cfqq_prio_changed(cfqq);

Expand Down

0 comments on commit 6769e3f

Please sign in to comment.