Skip to content

Commit b276a87

Browse files
committed
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: Tejun Heo <tj@kernel.org> Acked-by: Vivek Goyal <vgoyal@redhat.com>
1 parent d02f7aa commit b276a87

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎block/blk-cgroup.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,
113113

114114
blkg->pd[i] = pd;
115115
pd->blkg = blkg;
116+
pd->plid = i;
116117

117118
/* invoke per-policy init */
118119
if (pol->pd_init_fn)
@@ -908,6 +909,7 @@ int blkcg_activate_policy(struct request_queue *q,
908909

909910
blkg->pd[pol->plid] = pd;
910911
pd->blkg = blkg;
912+
pd->plid = pol->plid;
911913
pol->pd_init_fn(blkg);
912914

913915
spin_unlock(&blkg->blkcg->lock);

‎block/blk-cgroup.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ struct blkg_rwstat {
8181
* beginning and pd_size can't be smaller than pd.
8282
*/
8383
struct blkg_policy_data {
84-
/* the blkg this per-policy data belongs to */
84+
/* the blkg and policy id this per-policy data belongs to */
8585
struct blkcg_gq *blkg;
86+
int plid;
8687

8788
/* used during policy activation */
8889
struct list_head alloc_node;

0 commit comments

Comments
 (0)