Commit 653c45c6 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

blkcg, writeback: Implement wbc_blkcg_css()

Add a helper to determine the target blkcg from wbc.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 27b36d8f
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/flex_proportions.h> #include <linux/flex_proportions.h>
#include <linux/backing-dev-defs.h> #include <linux/backing-dev-defs.h>
#include <linux/blk_types.h> #include <linux/blk_types.h>
#include <linux/blk-cgroup.h>
struct bio; struct bio;
...@@ -101,6 +102,16 @@ static inline int wbc_to_write_flags(struct writeback_control *wbc) ...@@ -101,6 +102,16 @@ static inline int wbc_to_write_flags(struct writeback_control *wbc)
return 0; return 0;
} }
static inline struct cgroup_subsys_state *
wbc_blkcg_css(struct writeback_control *wbc)
{
#ifdef CONFIG_CGROUP_WRITEBACK
if (wbc->wb)
return wbc->wb->blkcg_css;
#endif
return blkcg_root_css;
}
/* /*
* A wb_domain represents a domain that wb's (bdi_writeback's) belong to * A wb_domain represents a domain that wb's (bdi_writeback's) belong to
* and are measured against each other in. There always is one global * and are measured against each other in. There always is one global
......
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