]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
blkcg, writeback: Implement wbc_blkcg_css()
authorTejun Heo <tj@kernel.org>
Thu, 27 Jun 2019 20:39:51 +0000 (13:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Jul 2019 15:00:57 +0000 (09:00 -0600)
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>
include/linux/writeback.h

index 33a50fa09facdf74a67e8454798df41900e29e5b..e056a22075cf4786d3a087e204967a410b03246d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/flex_proportions.h>
 #include <linux/backing-dev-defs.h>
 #include <linux/blk_types.h>
+#include <linux/blk-cgroup.h>
 
 struct bio;
 
@@ -101,6 +102,16 @@ static inline int wbc_to_write_flags(struct writeback_control *wbc)
        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
  * and are measured against each other in.  There always is one global