aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-05-14 16:52:31 -0400
committerTejun Heo <tj@kernel.org>2013-05-14 16:52:31 -0400
commitcb76199c36a7ccf0947ef4875b32e0940f50d1a8 (patch)
treed14184fb947d7cc622eed013d6a27ad4672fa9fc /block/blk-throttle.c
parent632b44935f4c99a61c56f8a6f805a1080ab5a432 (diff)
blk-throttle: collapse throtl_dispatch() into the work function
blk-throttle is about to go through major restructuring to support hierarchy. Do cosmetic updates in preparation. * s/throtl_data->throtl_work/throtl_data->dispatch_work/ * s/blk_throtl_work()/blk_throtl_dispatch_work_fn()/ * Collapse throtl_dispatch() into blk_throtl_dispatch_work_fn() This patch is purely cosmetic. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Vivek Goyal <vgoyal@redhat.com>
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r--block/blk-throttle.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 7dbd0e695df0..0a0bc00059df 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -108,7 +108,7 @@ struct throtl_data
108 unsigned int nr_undestroyed_grps; 108 unsigned int nr_undestroyed_grps;
109 109
110 /* Work for dispatching throttled bios */ 110 /* Work for dispatching throttled bios */
111 struct delayed_work throtl_work; 111 struct delayed_work dispatch_work;
112}; 112};
113 113
114/* list and work item to allocate percpu group stats */ 114/* list and work item to allocate percpu group stats */
@@ -820,10 +820,12 @@ static int throtl_select_dispatch(struct throtl_data *td, struct bio_list *bl)
820 return nr_disp; 820 return nr_disp;
821} 821}
822 822
823/* Dispatch throttled bios. Should be called without queue lock held. */ 823/* work function to dispatch throttled bios */
824static int throtl_dispatch(struct request_queue *q) 824void blk_throtl_dispatch_work_fn(struct work_struct *work)
825{ 825{
826 struct throtl_data *td = q->td; 826 struct throtl_data *td = container_of(to_delayed_work(work),
827 struct throtl_data, dispatch_work);
828 struct request_queue *q = td->queue;
827 unsigned int nr_disp = 0; 829 unsigned int nr_disp = 0;
828 struct bio_list bio_list_on_stack; 830 struct bio_list bio_list_on_stack;
829 struct bio *bio; 831 struct bio *bio;
@@ -859,16 +861,6 @@ out:
859 generic_make_request(bio); 861 generic_make_request(bio);
860 blk_finish_plug(&plug); 862 blk_finish_plug(&plug);
861 } 863 }
862 return nr_disp;
863}
864
865void blk_throtl_work(struct work_struct *work)
866{
867 struct throtl_data *td = container_of(work, struct throtl_data,
868 throtl_work.work);
869 struct request_queue *q = td->queue;
870
871 throtl_dispatch(q);
872} 864}
873 865
874/* Call with queue lock held */ 866/* Call with queue lock held */
@@ -876,7 +868,7 @@ static void
876throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay) 868throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay)
877{ 869{
878 870
879 struct delayed_work *dwork = &td->throtl_work; 871 struct delayed_work *dwork = &td->dispatch_work;
880 872
881 if (total_nr_queued(td)) { 873 if (total_nr_queued(td)) {
882 mod_delayed_work(kthrotld_workqueue, dwork, delay); 874 mod_delayed_work(kthrotld_workqueue, dwork, delay);
@@ -1057,7 +1049,7 @@ static void throtl_shutdown_wq(struct request_queue *q)
1057{ 1049{
1058 struct throtl_data *td = q->td; 1050 struct throtl_data *td = q->td;
1059 1051
1060 cancel_delayed_work_sync(&td->throtl_work); 1052 cancel_delayed_work_sync(&td->dispatch_work);
1061} 1053}
1062 1054
1063static struct blkcg_policy blkcg_policy_throtl = { 1055static struct blkcg_policy blkcg_policy_throtl = {
@@ -1206,7 +1198,7 @@ int blk_throtl_init(struct request_queue *q)
1206 return -ENOMEM; 1198 return -ENOMEM;
1207 1199
1208 td->tg_service_tree = THROTL_RB_ROOT; 1200 td->tg_service_tree = THROTL_RB_ROOT;
1209 INIT_DELAYED_WORK(&td->throtl_work, blk_throtl_work); 1201 INIT_DELAYED_WORK(&td->dispatch_work, blk_throtl_dispatch_work_fn);
1210 1202
1211 q->td = td; 1203 q->td = td;
1212 td->queue = q; 1204 td->queue = q;