Commit b276a876 authored by Tejun Heo's avatar Tejun Heo

blkcg: add blkg_policy_data->plid

Add pd->plid so that the policy a pd belongs to can be identified
easily.  This will be used to implement hierarchical blkg_[rw]stats.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
parent d02f7aa8
...@@ -113,6 +113,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, ...@@ -113,6 +113,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,
blkg->pd[i] = pd; blkg->pd[i] = pd;
pd->blkg = blkg; pd->blkg = blkg;
pd->plid = i;
/* invoke per-policy init */ /* invoke per-policy init */
if (pol->pd_init_fn) if (pol->pd_init_fn)
...@@ -908,6 +909,7 @@ int blkcg_activate_policy(struct request_queue *q, ...@@ -908,6 +909,7 @@ int blkcg_activate_policy(struct request_queue *q,
blkg->pd[pol->plid] = pd; blkg->pd[pol->plid] = pd;
pd->blkg = blkg; pd->blkg = blkg;
pd->plid = pol->plid;
pol->pd_init_fn(blkg); pol->pd_init_fn(blkg);
spin_unlock(&blkg->blkcg->lock); spin_unlock(&blkg->blkcg->lock);
......
...@@ -81,8 +81,9 @@ struct blkg_rwstat { ...@@ -81,8 +81,9 @@ struct blkg_rwstat {
* beginning and pd_size can't be smaller than pd. * beginning and pd_size can't be smaller than pd.
*/ */
struct blkg_policy_data { struct blkg_policy_data {
/* the blkg this per-policy data belongs to */ /* the blkg and policy id this per-policy data belongs to */
struct blkcg_gq *blkg; struct blkcg_gq *blkg;
int plid;
/* used during policy activation */ /* used during policy activation */
struct list_head alloc_node; struct list_head alloc_node;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment