aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-06-26 04:44:34 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-07-01 04:56:25 -0400
commitd5036d770f871bd34c9cfd955e6dee692e1e8e81 (patch)
treed0718922511121e96bdd385d6c28a254cfc93519 /block/cfq-iosched.c
parent61fd21670d048017c81e62f60894ef1b04b481db (diff)
cfq-iosched: move cfqq initialization out of cfq_find_alloc_queue()
We're going to be needing that init code outside of that function to get rid of the __GFP_NOFAIL in cfqq allocation. Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 833ec18eaa63..c760ae7019dd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1641,6 +1641,26 @@ static void cfq_ioc_set_ioprio(struct io_context *ioc)
1641 ioc->ioprio_changed = 0; 1641 ioc->ioprio_changed = 0;
1642} 1642}
1643 1643
1644static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1645 pid_t pid, int is_sync)
1646{
1647 RB_CLEAR_NODE(&cfqq->rb_node);
1648 RB_CLEAR_NODE(&cfqq->p_node);
1649 INIT_LIST_HEAD(&cfqq->fifo);
1650
1651 atomic_set(&cfqq->ref, 0);
1652 cfqq->cfqd = cfqd;
1653
1654 cfq_mark_cfqq_prio_changed(cfqq);
1655
1656 if (is_sync) {
1657 if (!cfq_class_idle(cfqq))
1658 cfq_mark_cfqq_idle_window(cfqq);
1659 cfq_mark_cfqq_sync(cfqq);
1660 }
1661 cfqq->pid = pid;
1662}
1663
1644static struct cfq_queue * 1664static struct cfq_queue *
1645cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync, 1665cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
1646 struct io_context *ioc, gfp_t gfp_mask) 1666 struct io_context *ioc, gfp_t gfp_mask)
@@ -1678,23 +1698,8 @@ retry:
1678 goto out; 1698 goto out;
1679 } 1699 }
1680 1700
1681 RB_CLEAR_NODE(&cfqq->rb_node); 1701 cfq_init_cfqq(cfqd, cfqq, current->pid, is_sync);
1682 RB_CLEAR_NODE(&cfqq->p_node);
1683 INIT_LIST_HEAD(&cfqq->fifo);
1684
1685 atomic_set(&cfqq->ref, 0);
1686 cfqq->cfqd = cfqd;
1687
1688 cfq_mark_cfqq_prio_changed(cfqq);
1689
1690 cfq_init_prio_data(cfqq, ioc); 1702 cfq_init_prio_data(cfqq, ioc);
1691
1692 if (is_sync) {
1693 if (!cfq_class_idle(cfqq))
1694 cfq_mark_cfqq_idle_window(cfqq);
1695 cfq_mark_cfqq_sync(cfqq);
1696 }
1697 cfqq->pid = current->pid;
1698 cfq_log_cfqq(cfqd, cfqq, "alloced"); 1703 cfq_log_cfqq(cfqd, cfqq, "alloced");
1699 } 1704 }
1700 1705