From: Yu Kuai <yukuai3@huawei.com>
To avoid abuse of bdi_dev_name().
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-throttle.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 6943ec720f39..35d86d7570c5 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1381,15 +1381,8 @@ static u64 tg_prfill_limit(struct seq_file *sf, struct blkg_policy_data *pd,
int off)
{
struct throtl_grp *tg = pd_to_tg(pd);
- const char *dname = blkg_dev_name(pd->blkg);
- u64 bps_dft;
- unsigned int iops_dft;
-
- if (!dname)
- return 0;
-
- bps_dft = U64_MAX;
- iops_dft = UINT_MAX;
+ u64 bps_dft = U64_MAX;
+ unsigned int iops_dft = UINT_MAX;
if (tg->bps[READ] == bps_dft &&
tg->bps[WRITE] == bps_dft &&
@@ -1397,7 +1390,9 @@ static u64 tg_prfill_limit(struct seq_file *sf, struct blkg_policy_data *pd,
tg->iops[WRITE] == iops_dft)
return 0;
- seq_printf(sf, "%s", dname);
+ if (!blkg_print_dev_name(sf, pd->blkg))
+ return 0;
+
if (tg->bps[READ] == U64_MAX)
seq_printf(sf, " rbps=max");
else
--
2.39.2