lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240930085302.1558217-6-yukuai1@huaweicloud.com>
Date: Mon, 30 Sep 2024 16:53:02 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: axboe@...nel.dk,
	tj@...nel.org,
	josef@...icpanda.com
Cc: linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org,
	yukuai3@...wei.com,
	yukuai1@...weicloud.com,
	yi.zhang@...wei.com,
	yangerkun@...wei.com
Subject: [PATCH 5/5] blk-cgroup: use new helper blkg_print_dev_name()

From: Yu Kuai <yukuai3@...wei.com>

To avoid abuse of bdi_dev_name(), and remove blkg_dev_name() since it's
not used anymore.

Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
 block/blk-cgroup-rwstat.c | 13 +++++++------
 block/blk-cgroup.c        | 19 ++++---------------
 block/blk-cgroup.h        |  1 -
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/block/blk-cgroup-rwstat.c b/block/blk-cgroup-rwstat.c
index a55fb0c53558..a0a1694572da 100644
--- a/block/blk-cgroup-rwstat.c
+++ b/block/blk-cgroup-rwstat.c
@@ -43,21 +43,22 @@ u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd,
 		[BLKG_RWSTAT_ASYNC]	= "Async",
 		[BLKG_RWSTAT_DISCARD]	= "Discard",
 	};
-	const char *dname = blkg_dev_name(pd->blkg);
 	u64 v;
 	int i;
 
-	if (!dname)
+	if (!pd->blkg->q->disk)
 		return 0;
 
-	for (i = 0; i < BLKG_RWSTAT_NR; i++)
-		seq_printf(sf, "%s %s %llu\n", dname, rwstr[i],
-			   rwstat->cnt[i]);
+	for (i = 0; i < BLKG_RWSTAT_NR; i++) {
+		blkg_print_dev_name(sf, pd->blkg);
+		seq_printf(sf, " %s %llu\n", rwstr[i], rwstat->cnt[i]);
+	}
 
 	v = rwstat->cnt[BLKG_RWSTAT_READ] +
 		rwstat->cnt[BLKG_RWSTAT_WRITE] +
 		rwstat->cnt[BLKG_RWSTAT_DISCARD];
-	seq_printf(sf, "%s Total %llu\n", dname, v);
+	blkg_print_dev_name(sf, pd->blkg);
+	seq_printf(sf, " Total %llu\n", v);
 	return v;
 }
 EXPORT_SYMBOL_GPL(__blkg_prfill_rwstat);
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index e68c725cf8d9..475fb826d92b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -682,13 +682,6 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
 	return 0;
 }
 
-const char *blkg_dev_name(struct blkcg_gq *blkg)
-{
-	if (!blkg->q->disk)
-		return NULL;
-	return bdi_dev_name(blkg->q->disk->bdi);
-}
-
 /**
  * blkcg_print_blkgs - helper for printing per-blkg data
  * @sf: seq_file to print to
@@ -740,12 +733,10 @@ EXPORT_SYMBOL_GPL(blkcg_print_blkgs);
  */
 u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v)
 {
-	const char *dname = blkg_dev_name(pd->blkg);
-
-	if (!dname)
+	if (!blkg_print_dev_name(sf, pd->blkg))
 		return 0;
 
-	seq_printf(sf, "%s %llu\n", dname, (unsigned long long)v);
+	seq_printf(sf, " %llu\n", (unsigned long long)v);
 	return v;
 }
 EXPORT_SYMBOL_GPL(__blkg_prfill_u64);
@@ -1144,18 +1135,16 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
 {
 	struct blkg_iostat_set *bis = &blkg->iostat;
 	u64 rbytes, wbytes, rios, wios, dbytes, dios;
-	const char *dname;
 	unsigned seq;
 	int i;
 
 	if (!blkg->online)
 		return;
 
-	dname = blkg_dev_name(blkg);
-	if (!dname)
+	if (!blkg_print_dev_name(s, blkg))
 		return;
 
-	seq_printf(s, "%s ", dname);
+	seq_putc(s, ' ');
 
 	do {
 		seq = u64_stats_fetch_begin(&bis->sync);
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index d62bcc2bae14..ab9365bc23ef 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -202,7 +202,6 @@ int blkcg_activate_policy(struct gendisk *disk, const struct blkcg_policy *pol);
 void blkcg_deactivate_policy(struct gendisk *disk,
 			     const struct blkcg_policy *pol);
 
-const char *blkg_dev_name(struct blkcg_gq *blkg);
 void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
 		       u64 (*prfill)(struct seq_file *,
 				     struct blkg_policy_data *, int),
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ