[2/8] blkcg, writeback: Implement wbc_blkcg_css()
diff mbox series

Message ID 20190614003350.1178444-3-tj@kernel.org
State New
Headers show
Series
  • [1/8] blkcg, writeback: Add wbc->no_wbc_acct
Related show

Commit Message

Tejun Heo June 14, 2019, 12:33 a.m. UTC
Add a helper to determine the target blkcg from wbc.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 include/linux/writeback.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Josef Bacik June 14, 2019, 1:41 p.m. UTC | #1
On Thu, Jun 13, 2019 at 05:33:44PM -0700, Tejun Heo wrote:
> Add a helper to determine the target blkcg from wbc.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

Patch
diff mbox series

diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b8f5f000cde4..1c85563f035d 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -93,6 +93,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