Skip to content

Commit dd4a4ff

Browse files
committed
blkcg: move blkg_for_each_descendant_pre() to block/blk-cgroup.h
blk-throttle hierarchy support will make use of it. Move blkg_for_each_descendant_pre() from block/blk-cgroup.c to block/blk-cgroup.h. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Vivek Goyal <vgoyal@redhat.com>
1 parent 2423c9c commit dd4a4ff

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,6 @@ EXPORT_SYMBOL_GPL(blkcg_root);
3232

3333
static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
3434

35-
static struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg,
36-
struct request_queue *q, bool update_hint);
37-
38-
/**
39-
* blkg_for_each_descendant_pre - pre-order walk of a blkg's descendants
40-
* @d_blkg: loop cursor pointing to the current descendant
41-
* @pos_cgrp: used for iteration
42-
* @p_blkg: target blkg to walk descendants of
43-
*
44-
* Walk @c_blkg through the descendants of @p_blkg. Must be used with RCU
45-
* read locked. If called under either blkcg or queue lock, the iteration
46-
* is guaranteed to include all and only online blkgs. The caller may
47-
* update @pos_cgrp by calling cgroup_rightmost_descendant() to skip
48-
* subtree.
49-
*/
50-
#define blkg_for_each_descendant_pre(d_blkg, pos_cgrp, p_blkg) \
51-
cgroup_for_each_descendant_pre((pos_cgrp), (p_blkg)->blkcg->css.cgroup) \
52-
if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \
53-
(p_blkg)->q, false)))
54-
5535
static bool blkcg_policy_enabled(struct request_queue *q,
5636
const struct blkcg_policy *pol)
5737
{
@@ -158,8 +138,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,
158138
* @q's bypass state. If @update_hint is %true, the caller should be
159139
* holding @q->queue_lock and lookup hint is updated on success.
160140
*/
161-
static struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg,
162-
struct request_queue *q, bool update_hint)
141+
struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, struct request_queue *q,
142+
bool update_hint)
163143
{
164144
struct blkcg_gq *blkg;
165145

‎block/blk-cgroup.h‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,26 @@ static inline void blkg_put(struct blkcg_gq *blkg)
282282
__blkg_release(blkg);
283283
}
284284

285+
struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, struct request_queue *q,
286+
bool update_hint);
287+
288+
/**
289+
* blkg_for_each_descendant_pre - pre-order walk of a blkg's descendants
290+
* @d_blkg: loop cursor pointing to the current descendant
291+
* @pos_cgrp: used for iteration
292+
* @p_blkg: target blkg to walk descendants of
293+
*
294+
* Walk @c_blkg through the descendants of @p_blkg. Must be used with RCU
295+
* read locked. If called under either blkcg or queue lock, the iteration
296+
* is guaranteed to include all and only online blkgs. The caller may
297+
* update @pos_cgrp by calling cgroup_rightmost_descendant() to skip
298+
* subtree.
299+
*/
300+
#define blkg_for_each_descendant_pre(d_blkg, pos_cgrp, p_blkg) \
301+
cgroup_for_each_descendant_pre((pos_cgrp), (p_blkg)->blkcg->css.cgroup) \
302+
if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \
303+
(p_blkg)->q, false)))
304+
285305
/**
286306
* blk_get_rl - get request_list to use
287307
* @q: request_queue of interest

0 commit comments

Comments
 (0)