diff mbox series

[RFC,v2,1/7] blk-cgroup: add a new helper pr_cont_blkg_path()

Message ID 20240618031751.3470464-2-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series blk-iocost: support to build iocost as kernel module | expand

Commit Message

Yu Kuai June 18, 2024, 3:17 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

To print blkg path in iocost, and prepare to build iocost as kernel
module.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-cgroup.c | 6 ++++++
 block/blk-cgroup.h | 1 +
 block/blk-iocost.c | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 37e6cc91d576..4da70fc7775e 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -2196,5 +2196,11 @@  bool blk_cgroup_congested(void)
 	return ret;
 }
 
+void pr_cont_blkg_path(struct blkcg_gq *blkg)
+{
+	return pr_cont_cgroup_path(blkg->blkcg->css.cgroup);
+}
+EXPORT_SYMBOL_GPL(pr_cont_blkg_path);
+
 module_param(blkcg_debug_stats, bool, 0644);
 MODULE_PARM_DESC(blkcg_debug_stats, "True if you want debug stats, false if not");
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 90b3959d88cf..25833221a12b 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -220,6 +220,7 @@  int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx);
 int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 		   struct blkg_conf_ctx *ctx);
 void blkg_conf_exit(struct blkg_conf_ctx *ctx);
+void pr_cont_blkg_path(struct blkcg_gq *blkg);
 
 /**
  * bio_issue_as_root_blkg - see if this bio needs to be issued as root blkg
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 690ca99dfaca..ca72a62bc9c0 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -1954,7 +1954,7 @@  static void transfer_surpluses(struct list_head *surpluses, struct ioc_now *now)
 				 iocg->hweight_donating <= 1 ||
 				 iocg->hweight_after_donation == 0)) {
 			pr_warn("iocg: invalid donation weights in ");
-			pr_cont_cgroup_path(iocg_to_blkg(iocg)->blkcg->css.cgroup);
+			pr_cont_blkg_path(iocg_to_blkg(iocg));
 			pr_cont(": active=%u donating=%u after=%u\n",
 				iocg->hweight_active, iocg->hweight_donating,
 				iocg->hweight_after_donation);