@@ -284,17 +284,18 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
284284 return tg ;
285285}
286286
287- static struct throtl_grp * throtl_rb_first (struct throtl_service_queue * sq )
287+ static struct throtl_grp *
288+ throtl_rb_first (struct throtl_service_queue * parent_sq )
288289{
289290 /* Service tree is empty */
290- if (!sq -> nr_pending )
291+ if (!parent_sq -> nr_pending )
291292 return NULL ;
292293
293- if (!sq -> first_pending )
294- sq -> first_pending = rb_first (& sq -> pending_tree );
294+ if (!parent_sq -> first_pending )
295+ parent_sq -> first_pending = rb_first (& parent_sq -> pending_tree );
295296
296- if (sq -> first_pending )
297- return rb_entry_tg (sq -> first_pending );
297+ if (parent_sq -> first_pending )
298+ return rb_entry_tg (parent_sq -> first_pending );
298299
299300 return NULL ;
300301}
@@ -305,29 +306,30 @@ static void rb_erase_init(struct rb_node *n, struct rb_root *root)
305306 RB_CLEAR_NODE (n );
306307}
307308
308- static void throtl_rb_erase (struct rb_node * n , struct throtl_service_queue * sq )
309+ static void throtl_rb_erase (struct rb_node * n ,
310+ struct throtl_service_queue * parent_sq )
309311{
310- if (sq -> first_pending == n )
311- sq -> first_pending = NULL ;
312- rb_erase_init (n , & sq -> pending_tree );
313- -- sq -> nr_pending ;
312+ if (parent_sq -> first_pending == n )
313+ parent_sq -> first_pending = NULL ;
314+ rb_erase_init (n , & parent_sq -> pending_tree );
315+ -- parent_sq -> nr_pending ;
314316}
315317
316- static void update_min_dispatch_time (struct throtl_service_queue * sq )
318+ static void update_min_dispatch_time (struct throtl_service_queue * parent_sq )
317319{
318320 struct throtl_grp * tg ;
319321
320- tg = throtl_rb_first (sq );
322+ tg = throtl_rb_first (parent_sq );
321323 if (!tg )
322324 return ;
323325
324- sq -> first_pending_disptime = tg -> disptime ;
326+ parent_sq -> first_pending_disptime = tg -> disptime ;
325327}
326328
327- static void tg_service_queue_add (struct throtl_service_queue * sq ,
328- struct throtl_grp * tg )
329+ static void tg_service_queue_add (struct throtl_grp * tg ,
330+ struct throtl_service_queue * parent_sq )
329331{
330- struct rb_node * * node = & sq -> pending_tree .rb_node ;
332+ struct rb_node * * node = & parent_sq -> pending_tree .rb_node ;
331333 struct rb_node * parent = NULL ;
332334 struct throtl_grp * __tg ;
333335 unsigned long key = tg -> disptime ;
@@ -346,39 +348,39 @@ static void tg_service_queue_add(struct throtl_service_queue *sq,
346348 }
347349
348350 if (left )
349- sq -> first_pending = & tg -> rb_node ;
351+ parent_sq -> first_pending = & tg -> rb_node ;
350352
351353 rb_link_node (& tg -> rb_node , parent , node );
352- rb_insert_color (& tg -> rb_node , & sq -> pending_tree );
354+ rb_insert_color (& tg -> rb_node , & parent_sq -> pending_tree );
353355}
354356
355- static void __throtl_enqueue_tg (struct throtl_service_queue * sq ,
356- struct throtl_grp * tg )
357+ static void __throtl_enqueue_tg (struct throtl_grp * tg ,
358+ struct throtl_service_queue * parent_sq )
357359{
358- tg_service_queue_add (sq , tg );
360+ tg_service_queue_add (tg , parent_sq );
359361 tg -> flags |= THROTL_TG_PENDING ;
360- sq -> nr_pending ++ ;
362+ parent_sq -> nr_pending ++ ;
361363}
362364
363- static void throtl_enqueue_tg (struct throtl_service_queue * sq ,
364- struct throtl_grp * tg )
365+ static void throtl_enqueue_tg (struct throtl_grp * tg ,
366+ struct throtl_service_queue * parent_sq )
365367{
366368 if (!(tg -> flags & THROTL_TG_PENDING ))
367- __throtl_enqueue_tg (sq , tg );
369+ __throtl_enqueue_tg (tg , parent_sq );
368370}
369371
370- static void __throtl_dequeue_tg (struct throtl_service_queue * sq ,
371- struct throtl_grp * tg )
372+ static void __throtl_dequeue_tg (struct throtl_grp * tg ,
373+ struct throtl_service_queue * parent_sq )
372374{
373- throtl_rb_erase (& tg -> rb_node , sq );
375+ throtl_rb_erase (& tg -> rb_node , parent_sq );
374376 tg -> flags &= ~THROTL_TG_PENDING ;
375377}
376378
377- static void throtl_dequeue_tg (struct throtl_service_queue * sq ,
378- struct throtl_grp * tg )
379+ static void throtl_dequeue_tg (struct throtl_grp * tg ,
380+ struct throtl_service_queue * parent_sq )
379381{
380382 if (tg -> flags & THROTL_TG_PENDING )
381- __throtl_dequeue_tg (sq , tg );
383+ __throtl_dequeue_tg (tg , parent_sq );
382384}
383385
384386/* Call with queue lock held */
@@ -691,8 +693,8 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio)
691693 throtl_update_dispatch_stats (tg_to_blkg (tg ), bio -> bi_size , bio -> bi_rw );
692694}
693695
694- static void throtl_add_bio_tg (struct throtl_service_queue * sq ,
695- struct throtl_grp * tg , struct bio * bio )
696+ static void throtl_add_bio_tg (struct bio * bio , struct throtl_grp * tg ,
697+ struct throtl_service_queue * parent_sq )
696698{
697699 bool rw = bio_data_dir (bio );
698700
@@ -701,11 +703,11 @@ static void throtl_add_bio_tg(struct throtl_service_queue *sq,
701703 blkg_get (tg_to_blkg (tg ));
702704 tg -> nr_queued [rw ]++ ;
703705 tg -> td -> nr_queued [rw ]++ ;
704- throtl_enqueue_tg (sq , tg );
706+ throtl_enqueue_tg (tg , parent_sq );
705707}
706708
707- static void tg_update_disptime (struct throtl_service_queue * sq ,
708- struct throtl_grp * tg )
709+ static void tg_update_disptime (struct throtl_grp * tg ,
710+ struct throtl_service_queue * parent_sq )
709711{
710712 unsigned long read_wait = -1 , write_wait = -1 , min_wait = -1 , disptime ;
711713 struct bio * bio ;
@@ -720,9 +722,9 @@ static void tg_update_disptime(struct throtl_service_queue *sq,
720722 disptime = jiffies + min_wait ;
721723
722724 /* Update dispatch time */
723- throtl_dequeue_tg (sq , tg );
725+ throtl_dequeue_tg (tg , parent_sq );
724726 tg -> disptime = disptime ;
725- throtl_enqueue_tg (sq , tg );
727+ throtl_enqueue_tg (tg , parent_sq );
726728}
727729
728730static void tg_dispatch_one_bio (struct throtl_grp * tg , bool rw ,
@@ -777,27 +779,27 @@ static int throtl_dispatch_tg(struct throtl_grp *tg, struct bio_list *bl)
777779 return nr_reads + nr_writes ;
778780}
779781
780- static int throtl_select_dispatch (struct throtl_service_queue * sq ,
782+ static int throtl_select_dispatch (struct throtl_service_queue * parent_sq ,
781783 struct bio_list * bl )
782784{
783785 unsigned int nr_disp = 0 ;
784786 struct throtl_grp * tg ;
785787
786788 while (1 ) {
787- tg = throtl_rb_first (sq );
789+ tg = throtl_rb_first (parent_sq );
788790
789791 if (!tg )
790792 break ;
791793
792794 if (time_before (jiffies , tg -> disptime ))
793795 break ;
794796
795- throtl_dequeue_tg (sq , tg );
797+ throtl_dequeue_tg (tg , parent_sq );
796798
797799 nr_disp += throtl_dispatch_tg (tg , bl );
798800
799801 if (tg -> nr_queued [0 ] || tg -> nr_queued [1 ])
800- tg_update_disptime (sq , tg );
802+ tg_update_disptime (tg , parent_sq );
801803
802804 if (nr_disp >= throtl_quantum )
803805 break ;
@@ -952,7 +954,7 @@ static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf,
952954 throtl_start_new_slice (tg , 1 );
953955
954956 if (tg -> flags & THROTL_TG_PENDING ) {
955- tg_update_disptime (& td -> service_queue , tg );
957+ tg_update_disptime (tg , & td -> service_queue );
956958 throtl_schedule_next_dispatch (td );
957959 }
958960
@@ -1106,11 +1108,11 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
11061108 tg -> nr_queued [READ ], tg -> nr_queued [WRITE ]);
11071109
11081110 bio_associate_current (bio );
1109- throtl_add_bio_tg (& q -> td -> service_queue , tg , bio );
1111+ throtl_add_bio_tg (bio , tg , & q -> td -> service_queue );
11101112 throttled = true;
11111113
11121114 if (update_disptime ) {
1113- tg_update_disptime (& td -> service_queue , tg );
1115+ tg_update_disptime (tg , & td -> service_queue );
11141116 throtl_schedule_next_dispatch (td );
11151117 }
11161118
@@ -1132,7 +1134,7 @@ void blk_throtl_drain(struct request_queue *q)
11321134 __releases (q - > queue_lock ) __acquires (q - > queue_lock )
11331135{
11341136 struct throtl_data * td = q -> td ;
1135- struct throtl_service_queue * sq = & td -> service_queue ;
1137+ struct throtl_service_queue * parent_sq = & td -> service_queue ;
11361138 struct throtl_grp * tg ;
11371139 struct bio_list bl ;
11381140 struct bio * bio ;
@@ -1141,8 +1143,8 @@ void blk_throtl_drain(struct request_queue *q)
11411143
11421144 bio_list_init (& bl );
11431145
1144- while ((tg = throtl_rb_first (sq ))) {
1145- throtl_dequeue_tg (sq , tg );
1146+ while ((tg = throtl_rb_first (parent_sq ))) {
1147+ throtl_dequeue_tg (tg , parent_sq );
11461148
11471149 while ((bio = bio_list_peek (& tg -> bio_lists [READ ])))
11481150 tg_dispatch_one_bio (tg , bio_data_dir (bio ), & bl );
0 commit comments