cgroup writeback support would need to tell whether a given blkcg cgroup_subsys_state is the root one or not. Add global constant blkcg_root_css which points to &blkcg_root.css. If blkcg is disabled, it's defined as ERR_PTR(-EINVAL).
Signed-off-by: Tejun Heo <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Jens Axboe <[email protected]> --- block/blk-cgroup.c | 2 ++ include/linux/blkdev.h | 6 ++++++ 2 files changed, 8 insertions(+) --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -30,6 +30,8 @@ struct blkcg blkcg_root = { .cfq_weight .cfq_leaf_weight = 2 * CFQ_WEIGHT_DEFAULT, }; EXPORT_SYMBOL_GPL(blkcg_root); +struct cgroup_subsys_state * const blkcg_root_css = &blkcg_root.css; + static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; static bool blkcg_policy_enabled(struct request_queue *q, --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1408,6 +1408,9 @@ int kblockd_schedule_delayed_work(struct int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); #ifdef CONFIG_BLK_CGROUP + +extern struct cgroup_subsys_state * const blkcg_root_css; + /* * This should not be using sched_clock(). A real patch is in progress * to fix this up, until that is in place we need to disable preemption @@ -1437,6 +1440,9 @@ static inline uint64_t rq_io_start_time_ return req->io_start_time_ns; } #else + +#define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) + static inline void set_start_time_ns(struct request *req) {} static inline void set_io_start_time_ns(struct request *req) {} static inline uint64_t rq_start_time_ns(struct request *req) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

