Skip to content

Commit

Permalink
blkcg: implement task_get_blkcg_css()
Browse files Browse the repository at this point in the history
Implement a wrapper around task_get_css() to acquire the blkcg css for
a given task.  The wrapper is necessary for cgroup writeback support
as there will be places outside blkcg proper trying to acquire
blkcg_css and blkio_cgrp_id will be undefined when !CONFIG_BLK_CGROUP.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Jun 2, 2015
1 parent ec43869 commit fd383c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/linux/blk-cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ static inline struct blkcg *bio_blkcg(struct bio *bio)
return task_blkcg(current);
}

static inline struct cgroup_subsys_state *
task_get_blkcg_css(struct task_struct *task)
{
return task_get_css(task, blkio_cgrp_id);
}

/**
* blkcg_parent - get the parent of a blkcg
* @blkcg: blkcg of interest
Expand Down Expand Up @@ -573,6 +579,12 @@ struct blkcg_policy {

#define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL))

static inline struct cgroup_subsys_state *
task_get_blkcg_css(struct task_struct *task)
{
return NULL;
}

#ifdef CONFIG_BLOCK

static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; }
Expand Down

0 comments on commit fd383c2

Please sign in to comment.