diff options
author | Tejun Heo <tj@kernel.org> | 2019-06-27 16:39:51 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-07-10 11:00:57 -0400 |
commit | 653c45c6b90c9659facbef10546d1f3a8e37d0cf (patch) | |
tree | 41f5f5435fdb7c50c7ad682fc1dc214a4f33a1dc | |
parent | 27b36d8fa81fa8274fb72f4eb1484026f6b6daa8 (diff) |
blkcg, writeback: Implement wbc_blkcg_css()
Add a helper to determine the target blkcg from wbc.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | include/linux/writeback.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 33a50fa09fac..e056a22075cf 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/flex_proportions.h> | 11 | #include <linux/flex_proportions.h> |
12 | #include <linux/backing-dev-defs.h> | 12 | #include <linux/backing-dev-defs.h> |
13 | #include <linux/blk_types.h> | 13 | #include <linux/blk_types.h> |
14 | #include <linux/blk-cgroup.h> | ||
14 | 15 | ||
15 | struct bio; | 16 | struct bio; |
16 | 17 | ||
@@ -101,6 +102,16 @@ static inline int wbc_to_write_flags(struct writeback_control *wbc) | |||
101 | return 0; | 102 | return 0; |
102 | } | 103 | } |
103 | 104 | ||
105 | static inline struct cgroup_subsys_state * | ||
106 | wbc_blkcg_css(struct writeback_control *wbc) | ||
107 | { | ||
108 | #ifdef CONFIG_CGROUP_WRITEBACK | ||
109 | if (wbc->wb) | ||
110 | return wbc->wb->blkcg_css; | ||
111 | #endif | ||
112 | return blkcg_root_css; | ||
113 | } | ||
114 | |||
104 | /* | 115 | /* |
105 | * A wb_domain represents a domain that wb's (bdi_writeback's) belong to | 116 | * A wb_domain represents a domain that wb's (bdi_writeback's) belong to |
106 | * and are measured against each other in. There always is one global | 117 | * and are measured against each other in. There always is one global |