ath10k: fix ath10k_bss_assoc() to not sleep in atomic context
[cascardo/linux.git] / block / blk-cgroup.h
index 11f5b92..8056c03 100644 (file)
@@ -266,7 +266,7 @@ static inline void blkg_get(struct blkcg_gq *blkg)
        blkg->refcnt++;
 }
 
-void __blkg_release(struct blkcg_gq *blkg);
+void __blkg_release_rcu(struct rcu_head *rcu);
 
 /**
  * blkg_put - put a blkg reference
@@ -279,7 +279,7 @@ static inline void blkg_put(struct blkcg_gq *blkg)
        lockdep_assert_held(blkg->q->queue_lock);
        WARN_ON_ONCE(blkg->refcnt <= 0);
        if (!--blkg->refcnt)
-               __blkg_release(blkg);
+               call_rcu(&blkg->rcu_head, __blkg_release_rcu);
 }
 
 struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, struct request_queue *q,
@@ -302,6 +302,20 @@ struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, struct request_queue *q,
                if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \
                                              (p_blkg)->q, false)))
 
+/**
+ * blkg_for_each_descendant_post - post-order walk of a blkg's descendants
+ * @d_blkg: loop cursor pointing to the current descendant
+ * @pos_cgrp: used for iteration
+ * @p_blkg: target blkg to walk descendants of
+ *
+ * Similar to blkg_for_each_descendant_pre() but performs post-order
+ * traversal instead.  Synchronization rules are the same.
+ */
+#define blkg_for_each_descendant_post(d_blkg, pos_cgrp, p_blkg)                \
+       cgroup_for_each_descendant_post((pos_cgrp), (p_blkg)->blkcg->css.cgroup) \
+               if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \
+                                             (p_blkg)->q, false)))
+
 /**
  * blk_get_rl - get request_list to use
  * @q: request_queue of interest