Lines Matching refs:blkcg

45 struct blkcg blkcg_root;
79 if (blkg->blkcg != &blkcg_root) in blkg_free()
95 static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, in blkg_alloc() argument
112 blkg->blkcg = blkcg; in blkg_alloc()
116 if (blkcg != &blkcg_root) { in blkg_alloc()
146 struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, in blkg_lookup_slowpath() argument
157 blkg = radix_tree_lookup(&blkcg->blkg_tree, q->id); in blkg_lookup_slowpath()
161 rcu_assign_pointer(blkcg->blkg_hint, blkg); in blkg_lookup_slowpath()
174 static struct blkcg_gq *blkg_create(struct blkcg *blkcg, in blkg_create() argument
186 if (!css_tryget_online(&blkcg->css)) { in blkg_create()
192 blkcg->css.id, in blkg_create()
201 new_blkg = blkg_alloc(blkcg, q, GFP_NOWAIT | __GFP_NOWARN); in blkg_create()
211 if (blkcg_parent(blkcg)) { in blkg_create()
212 blkg->parent = __blkg_lookup(blkcg_parent(blkcg), q, false); in blkg_create()
229 spin_lock(&blkcg->lock); in blkg_create()
230 ret = radix_tree_insert(&blkcg->blkg_tree, q->id, blkg); in blkg_create()
232 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list); in blkg_create()
243 spin_unlock(&blkcg->lock); in blkg_create()
255 css_put(&blkcg->css); in blkg_create()
275 struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, in blkg_lookup_create() argument
290 blkg = __blkg_lookup(blkcg, q, true); in blkg_lookup_create()
299 struct blkcg *pos = blkcg; in blkg_lookup_create()
300 struct blkcg *parent = blkcg_parent(blkcg); in blkg_lookup_create()
308 if (pos == blkcg || IS_ERR(blkg)) in blkg_lookup_create()
315 struct blkcg *blkcg = blkg->blkcg; in blkg_destroy() local
320 lockdep_assert_held(&blkcg->lock); in blkg_destroy()
340 radix_tree_delete(&blkcg->blkg_tree, blkg->q->id); in blkg_destroy()
349 if (rcu_access_pointer(blkcg->blkg_hint) == blkg) in blkg_destroy()
350 rcu_assign_pointer(blkcg->blkg_hint, NULL); in blkg_destroy()
372 struct blkcg *blkcg = blkg->blkcg; in blkg_destroy_all() local
374 spin_lock(&blkcg->lock); in blkg_destroy_all()
376 spin_unlock(&blkcg->lock); in blkg_destroy_all()
396 css_put(&blkg->blkcg->css); in __blkg_release_rcu()
444 struct blkcg *blkcg = css_to_blkcg(css); in blkcg_reset_stats() local
449 spin_lock_irq(&blkcg->lock); in blkcg_reset_stats()
456 hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) { in blkcg_reset_stats()
468 spin_unlock_irq(&blkcg->lock); in blkcg_reset_stats()
500 void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, in blkcg_print_blkgs() argument
510 hlist_for_each_entry_rcu(blkg, &blkcg->blkg_list, blkcg_node) { in blkcg_print_blkgs()
781 static struct blkcg_gq *blkg_lookup_check(struct blkcg *blkcg, in blkg_lookup_check() argument
798 return __blkg_lookup(blkcg, q, true /* update_hint */); in blkg_lookup_check()
813 int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, in blkg_conf_prep() argument
845 blkg = blkg_lookup_check(blkcg, pol, q); in blkg_conf_prep()
859 struct blkcg *pos = blkcg; in blkg_conf_prep()
860 struct blkcg *parent; in blkg_conf_prep()
863 parent = blkcg_parent(blkcg); in blkg_conf_prep()
898 if (pos == blkcg) in blkg_conf_prep()
944 struct blkcg *blkcg = css_to_blkcg(seq_css(sf)); in blkcg_print_stat() local
949 hlist_for_each_entry_rcu(blkg, &blkcg->blkg_list, blkcg_node) { in blkcg_print_stat()
1076 struct blkcg *blkcg = css_to_blkcg(css); in blkcg_css_offline() local
1079 wb_blkcg_offline(blkcg); in blkcg_css_offline()
1082 blkcg_cgwb_put(blkcg); in blkcg_css_offline()
1096 void blkcg_destroy_blkgs(struct blkcg *blkcg) in blkcg_destroy_blkgs() argument
1098 spin_lock_irq(&blkcg->lock); in blkcg_destroy_blkgs()
1100 while (!hlist_empty(&blkcg->blkg_list)) { in blkcg_destroy_blkgs()
1101 struct blkcg_gq *blkg = hlist_entry(blkcg->blkg_list.first, in blkcg_destroy_blkgs()
1109 spin_unlock_irq(&blkcg->lock); in blkcg_destroy_blkgs()
1111 spin_lock_irq(&blkcg->lock); in blkcg_destroy_blkgs()
1115 spin_unlock_irq(&blkcg->lock); in blkcg_destroy_blkgs()
1120 struct blkcg *blkcg = css_to_blkcg(css); in blkcg_css_free() local
1125 list_del(&blkcg->all_blkcgs_node); in blkcg_css_free()
1128 if (blkcg->cpd[i]) in blkcg_css_free()
1129 blkcg_policy[i]->cpd_free_fn(blkcg->cpd[i]); in blkcg_css_free()
1133 kfree(blkcg); in blkcg_css_free()
1139 struct blkcg *blkcg; in blkcg_css_alloc() local
1146 blkcg = &blkcg_root; in blkcg_css_alloc()
1148 blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL); in blkcg_css_alloc()
1149 if (!blkcg) { in blkcg_css_alloc()
1173 blkcg->cpd[i] = cpd; in blkcg_css_alloc()
1174 cpd->blkcg = blkcg; in blkcg_css_alloc()
1180 spin_lock_init(&blkcg->lock); in blkcg_css_alloc()
1181 INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT | __GFP_NOWARN); in blkcg_css_alloc()
1182 INIT_HLIST_HEAD(&blkcg->blkg_list); in blkcg_css_alloc()
1184 INIT_LIST_HEAD(&blkcg->cgwb_list); in blkcg_css_alloc()
1185 refcount_set(&blkcg->cgwb_refcnt, 1); in blkcg_css_alloc()
1187 list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); in blkcg_css_alloc()
1190 return &blkcg->css; in blkcg_css_alloc()
1194 if (blkcg->cpd[i]) in blkcg_css_alloc()
1195 blkcg_policy[i]->cpd_free_fn(blkcg->cpd[i]); in blkcg_css_alloc()
1197 if (blkcg != &blkcg_root) in blkcg_css_alloc()
1198 kfree(blkcg); in blkcg_css_alloc()
1333 struct blkcg *blkcg; in blkcg_bind() local
1338 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) in blkcg_bind()
1339 if (blkcg->cpd[pol->plid]) in blkcg_bind()
1340 pol->cpd_bind_fn(blkcg->cpd[pol->plid]); in blkcg_bind()
1502 struct blkcg *blkcg; in blkcg_policy_register() local
1529 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { in blkcg_policy_register()
1536 blkcg->cpd[pol->plid] = cpd; in blkcg_policy_register()
1537 cpd->blkcg = blkcg; in blkcg_policy_register()
1557 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { in blkcg_policy_register()
1558 if (blkcg->cpd[pol->plid]) { in blkcg_policy_register()
1559 pol->cpd_free_fn(blkcg->cpd[pol->plid]); in blkcg_policy_register()
1560 blkcg->cpd[pol->plid] = NULL; in blkcg_policy_register()
1580 struct blkcg *blkcg; in blkcg_policy_unregister() local
1597 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { in blkcg_policy_unregister()
1598 if (blkcg->cpd[pol->plid]) { in blkcg_policy_unregister()
1599 pol->cpd_free_fn(blkcg->cpd[pol->plid]); in blkcg_policy_unregister()
1600 blkcg->cpd[pol->plid] = NULL; in blkcg_policy_unregister()
1729 struct blkcg *blkcg; in blkcg_maybe_throttle_current() local
1742 blkcg = css_to_blkcg(css); in blkcg_maybe_throttle_current()
1744 blkcg = css_to_blkcg(task_css(current, io_cgrp_id)); in blkcg_maybe_throttle_current()
1746 if (!blkcg) in blkcg_maybe_throttle_current()
1748 blkg = blkg_lookup(blkcg, q); in blkcg_maybe_throttle_current()