From nobody Thu Nov 28 15:46:26 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5131613DB92; Mon, 30 Sep 2024 08:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686574; cv=none; b=VM16x9zgIpzTpatINqkejp1rYmjd3aHdToi413S5JzkKhC71wquh69IRWVPM5swx3BV845T05i4LLGerlWP/A8Wc8cnapq0kj+RcnUwmpiIDanFrw4GhfzANxx1zhUXhUPZ1RCFqSyqpnUBDWgFnXjSXSj1eyn1Y7g8I2eNf68Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686574; c=relaxed/simple; bh=F5hBlWKSQTKJ0TBhuFW7eiyaUzN2AmHFwdYvxcrj45c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d/5E+De0hPLmcyj6pbxSFOVWioxsC3MTg7njnGpK9Yiu5r1W0gf5uOlF8k6J432++JzOvw0MoR7dE4euMOegSp5zfx2kOEquCrWq5fa1UGldP6ydWEcgqjDAMVyiCgkGayTwaOcmkVT1DWGcmzAehpzDCdyo1L/8sR2OaM71j0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XHFKT3Z8pz4f3kkG; Mon, 30 Sep 2024 16:55:57 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id E05931A0568; Mon, 30 Sep 2024 16:56:08 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCn28emZ_pmgEUMCw--.63034S5; Mon, 30 Sep 2024 16:56:08 +0800 (CST) From: Yu Kuai To: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH v2 1/5] blk-cgroup: add a new helper blkg_print_dev_name() Date: Mon, 30 Sep 2024 16:52:58 +0800 Message-Id: <20240930085302.1558217-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930085302.1558217-1-yukuai1@huaweicloud.com> References: <20240930085302.1558217-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCn28emZ_pmgEUMCw--.63034S5 X-Coremail-Antispam: 1UD129KBjvdXoWrur17Zw17Aw1kCrWDJF4DXFb_yoWDCFX_WF 97Cry8X3Z3Aan7GF90yFnIqrWUCw45XrW0gasIgF9rAF13XFs7A3y7Jw4kJ3yxuFZxG345 C3y7Ars7CrnavjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbkxFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY02 0Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY04 v7MxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7 AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE 2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcV C2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kfnx nUUI43ZEXa7VUbn2-7UUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai The bdi_dev_name() should not be used in blk-cgroup code, because bdi is not related at all, add a new helper to print device name directly from gendisk. The helper can also fix that "unknown" will be printed for hidden disks. Signed-off-by: Yu Kuai --- block/blk-cgroup.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index b9e3265c1eb3..d62bcc2bae14 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h @@ -239,6 +239,18 @@ static inline bool bio_issue_as_root_blkg(struct bio *= bio) return (bio->bi_opf & (REQ_META | REQ_SWAP)) !=3D 0; } =20 +static inline bool blkg_print_dev_name(struct seq_file *sf, + struct blkcg_gq *blkg) +{ + struct gendisk *disk =3D blkg->q->disk; + + if (!disk) + return false; + + seq_printf(sf, "%u:%u", disk->major, disk->first_minor); + return true; +} + /** * blkg_lookup - lookup blkg for the specified blkcg - q pair * @blkcg: blkcg of interest --=20 2.39.2 From nobody Thu Nov 28 15:46:26 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5136C17E01C; Mon, 30 Sep 2024 08:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686575; cv=none; b=OMzmIbHVfbZG/hXMCd116NfMW5EIrX3XcayB5kPUVBNsJu0ecIEh9ziho1TCpjwx2p0TwmnkoZff8YN+2b1Cjn1qqL0I45DUs0Yel3rmk5R1F6Cdy+YZx2MQqH/LhqCgAKmp38ougYe9LvgmY+p59TmO7dYyxP1iQD5WmsyvNE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686575; c=relaxed/simple; bh=drZJL2piV7NklwiJ2htFBgPFgSly6mlsIsh7VP8yoMo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lh4UITRDry5Rv7/yOMG8nuSmhAdbid2GvB3XjPSZH43xK387D44/WDXpP7IptohnRxxfsWsXczA5f0nHQ5ObxxIJZnxsRYTc8nC/MVDgevBmNQB9Bv9mfNfDe3iJu3k5cCh678Ob9FhuhfqU1W9x+83OiQCj0srpQ7PJnVfl4fs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XHFKN1GqQz4f3nby; Mon, 30 Sep 2024 16:55:52 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 570081A07B6; Mon, 30 Sep 2024 16:56:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCn28emZ_pmgEUMCw--.63034S6; Mon, 30 Sep 2024 16:56:09 +0800 (CST) From: Yu Kuai To: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH 2/5] blk-iocost: use new helper blkg_print_dev_name() Date: Mon, 30 Sep 2024 16:52:59 +0800 Message-Id: <20240930085302.1558217-3-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930085302.1558217-1-yukuai1@huaweicloud.com> References: <20240930085302.1558217-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCn28emZ_pmgEUMCw--.63034S6 X-Coremail-Antispam: 1UD129KBjvJXoWxGry5Cr47tFW5XryxZw17Awb_yoW5Xry5pF Wa939rt3yavr1IqF13JF42vwn5Gw4jgr43XrZ3CryfG3W2qr1IgFnrCryvyr4rZa4fArZ8 WFZagr4UCr17ZwUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUm014x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWU JVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67 kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY 6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0x vEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVj vjDU0xZFpf9x0JUczV8UUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai To avoid abuse of bdi_dev_name(). Signed-off-by: Yu Kuai --- block/blk-iocost.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 5a6098a3db57..eede926937ac 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3067,11 +3067,14 @@ static void ioc_pd_stat(struct blkg_policy_data *pd= , struct seq_file *s) static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data = *pd, int off) { - const char *dname =3D blkg_dev_name(pd->blkg); struct ioc_gq *iocg =3D pd_to_iocg(pd); =20 - if (dname && iocg->cfg_weight) - seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE); + if (!iocg->cfg_weight) + return 0; + + if (blkg_print_dev_name(sf, pd->blkg)) + seq_printf(sf, " %u\n", iocg->cfg_weight / WEIGHT_ONE); + return 0; } =20 @@ -3160,15 +3163,14 @@ static ssize_t ioc_weight_write(struct kernfs_open_= file *of, char *buf, static u64 ioc_qos_prfill(struct seq_file *sf, struct blkg_policy_data *pd, int off) { - const char *dname =3D blkg_dev_name(pd->blkg); struct ioc *ioc =3D pd_to_iocg(pd)->ioc; =20 - if (!dname) + if (!blkg_print_dev_name(sf, pd->blkg)) return 0; =20 spin_lock_irq(&ioc->lock); - seq_printf(sf, "%s enable=3D%d ctrl=3D%s rpct=3D%u.%02u rlat=3D%u wpct=3D= %u.%02u wlat=3D%u min=3D%u.%02u max=3D%u.%02u\n", - dname, ioc->enabled, ioc->user_qos_params ? "user" : "auto", + seq_printf(sf, " enable=3D%d ctrl=3D%s rpct=3D%u.%02u rlat=3D%u wpct=3D%u= .%02u wlat=3D%u min=3D%u.%02u max=3D%u.%02u\n", + ioc->enabled, ioc->user_qos_params ? "user" : "auto", ioc->params.qos[QOS_RPPM] / 10000, ioc->params.qos[QOS_RPPM] % 10000 / 100, ioc->params.qos[QOS_RLAT], @@ -3359,18 +3361,17 @@ static ssize_t ioc_qos_write(struct kernfs_open_fil= e *of, char *input, static u64 ioc_cost_model_prfill(struct seq_file *sf, struct blkg_policy_data *pd, int off) { - const char *dname =3D blkg_dev_name(pd->blkg); struct ioc *ioc =3D pd_to_iocg(pd)->ioc; u64 *u =3D ioc->params.i_lcoefs; =20 - if (!dname) + if (!blkg_print_dev_name(sf, pd->blkg)) return 0; =20 spin_lock_irq(&ioc->lock); - seq_printf(sf, "%s ctrl=3D%s model=3Dlinear " + seq_printf(sf, " ctrl=3D%s model=3Dlinear " "rbps=3D%llu rseqiops=3D%llu rrandiops=3D%llu " "wbps=3D%llu wseqiops=3D%llu wrandiops=3D%llu\n", - dname, ioc->user_cost_model ? "user" : "auto", + ioc->user_cost_model ? "user" : "auto", u[I_LCOEF_RBPS], u[I_LCOEF_RSEQIOPS], u[I_LCOEF_RRANDIOPS], u[I_LCOEF_WBPS], u[I_LCOEF_WSEQIOPS], u[I_LCOEF_WRANDIOPS]); spin_unlock_irq(&ioc->lock); --=20 2.39.2 From nobody Thu Nov 28 15:46:26 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E85F17E918; Mon, 30 Sep 2024 08:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686576; cv=none; b=QMuqiwYS0yAn/M+zZNY1hF4W/2CEGSEaFHayk4raJyBmLxayZLwTWmDWavQK3/PnJ2j0uQMl5EeeL6joLGZsU7PJhN4BgkHZu/Ej7fv34FAwZhVcNAA4pK098bkeIucacJKlS7rwwX2DaS3OBDVXurHnzG7H93pGrUU7T3A4+OE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686576; c=relaxed/simple; bh=Cv5Fqr5fUDP+WM4qhGcV6/fa5KcFQBnq86VjMWn/mtI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=StiAFTxNd9s0QdNJ8vDT/WvPNnJeUiklovfMOnLVfo3L/uoYmyYK8A0UuIEyrr60Co4PvM0M+iUlc9Ixu9AQziQwVBVPfD/HJ8xhHcv1BMBR3NFP6s4SZ7ry3VGRvKMp0QRrvQ/9pofk1AyMv7eRGNzjTFtLeSGJ+CmS8z/ZVUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XHFKV2kGhz4f3kkd; Mon, 30 Sep 2024 16:55:58 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id C43991A058E; Mon, 30 Sep 2024 16:56:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCn28emZ_pmgEUMCw--.63034S7; Mon, 30 Sep 2024 16:56:09 +0800 (CST) From: Yu Kuai To: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH 3/5] blk-throttle: use new helper blkg_print_dev_name() Date: Mon, 30 Sep 2024 16:53:00 +0800 Message-Id: <20240930085302.1558217-4-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930085302.1558217-1-yukuai1@huaweicloud.com> References: <20240930085302.1558217-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCn28emZ_pmgEUMCw--.63034S7 X-Coremail-Antispam: 1UD129KBjvdXoWrZF1rCw48AF15Kr43WFWfZrb_yoWkAFg_uF ykCr18XFn3Ja4kArWDAr95ZFW2g3Zaqr10ga48Ja4xZr1aqan5Jay7XrsrKrWxZFWSk3sx J3Z8XrW8AF1FqjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbkxFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWwA2048vs2IY02 0Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY04 v7MxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7 AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE 2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcV C2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kfnx nUUI43ZEXa7VUbpwZ7UUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai To avoid abuse of bdi_dev_name(). Signed-off-by: Yu Kuai --- 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, stru= ct blkg_policy_data *pd, int off) { struct throtl_grp *tg =3D pd_to_tg(pd); - const char *dname =3D blkg_dev_name(pd->blkg); - u64 bps_dft; - unsigned int iops_dft; - - if (!dname) - return 0; - - bps_dft =3D U64_MAX; - iops_dft =3D UINT_MAX; + u64 bps_dft =3D U64_MAX; + unsigned int iops_dft =3D UINT_MAX; =20 if (tg->bps[READ] =3D=3D bps_dft && tg->bps[WRITE] =3D=3D bps_dft && @@ -1397,7 +1390,9 @@ static u64 tg_prfill_limit(struct seq_file *sf, struc= t blkg_policy_data *pd, tg->iops[WRITE] =3D=3D iops_dft) return 0; =20 - seq_printf(sf, "%s", dname); + if (!blkg_print_dev_name(sf, pd->blkg)) + return 0; + if (tg->bps[READ] =3D=3D U64_MAX) seq_printf(sf, " rbps=3Dmax"); else --=20 2.39.2 From nobody Thu Nov 28 15:46:26 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E80C17DFEB; Mon, 30 Sep 2024 08:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686574; cv=none; b=YkRTRKQl5zu3Xssk4OlAqHhWQunn/tdISCZH+ybx5AD8d+Gvnn1BGvcb+9xcpklbQg9AyDcuz0OwIMuP2vV2CX5Z/tnq+KeGtdb1fpXw3ri0Pufl0S829qUOpFypShyy8ROFgUZLQ2wDtdLewHV2uuF+JqTLiQZFEPb/jjhiGv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686574; c=relaxed/simple; bh=og/ZpgLgLs3C+isRBPNaeHdFYY+98m7ego/AVEB96tk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sgr6yXHBkR+gDlP9RFEwAzfBjNS9+/U43m8ACh0mlA7PyS3E063PI8BGccyp8BVRC51lptrMO3g5yVyuBuqyPbDI4V3w4H2Ig0S+t6GVqvtAfxco3iWdTfbZmQ60PGujbwttQ5xx14iLItURcWQqe83iMH5prpnkQjvtwRVxuiA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XHFKP0KQgz4f3nV8; Mon, 30 Sep 2024 16:55:53 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 37C981A092F; Mon, 30 Sep 2024 16:56:10 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCn28emZ_pmgEUMCw--.63034S8; Mon, 30 Sep 2024 16:56:10 +0800 (CST) From: Yu Kuai To: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH 4/5] blk-iolatency: use new helper blkg_print_dev_name() Date: Mon, 30 Sep 2024 16:53:01 +0800 Message-Id: <20240930085302.1558217-5-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930085302.1558217-1-yukuai1@huaweicloud.com> References: <20240930085302.1558217-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCn28emZ_pmgEUMCw--.63034S8 X-Coremail-Antispam: 1UD129KBjvdXoWrZF1rCw48AF1rJr1rJr1xAFb_yoWfKwbE9F Z7Z3ZIvr93WF4YvFWkCF1fXry0kr1kXF1xWayxA34DZF4FqFWkAFZrArs09F4aqF4xK345 AF98ur4fJr1IqjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbv8FF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2 IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28E F7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr 1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7MxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY 6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2 KfnxnUUI43ZEXa7VUbPC7UUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai To avoid abuse of bdi_dev_name(). Signed-off-by: Yu Kuai --- block/blk-iolatency.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index ebb522788d97..9c9ab4a73e0b 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -898,12 +898,15 @@ static u64 iolatency_prfill_limit(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct iolatency_grp *iolat =3D pd_to_lat(pd); - const char *dname =3D blkg_dev_name(pd->blkg); =20 - if (!dname || !iolat->min_lat_nsec) + if (!iolat->min_lat_nsec) return 0; - seq_printf(sf, "%s target=3D%llu\n", - dname, div_u64(iolat->min_lat_nsec, NSEC_PER_USEC)); + + if (!blkg_print_dev_name(sf, pd->blkg)) + return 0; + + seq_printf(sf, " target=3D%llu\n", + div_u64(iolat->min_lat_nsec, NSEC_PER_USEC)); return 0; } =20 --=20 2.39.2 From nobody Thu Nov 28 15:46:26 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66B5017F394; Mon, 30 Sep 2024 08:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686575; cv=none; b=eV5qW6AeVu4oCjwXJlLjZy686SqfjKVzhbQkwymkeZa25TR+rWpDNfNiJuA9YilNISQ2ZasHXIA/5DeWRFNpYTUrmAKPzuuQ8TBx4b0SORfEemqPVNwYUKRH3nt3BQfqvyFyb2orAK5UhFxD1BdV6Jt0B2D2pmLiFpLWUfqciqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727686575; c=relaxed/simple; bh=RFIvMPwKm0xIVQzM4CMA7QmMFVA7grTf9FolwLFzK9c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KQTwvU/Y+6CYDrEcAcDNDENgQHttuNzWYxGLkGLjJaOdU/dHq5aMq1RJslO+EI7uQZgWEu1lwO0HBcFG8oVw+VbLJmS4mel+xYbbsRIu22s2ZbfBsBH9Lo8myVcVpY9jDWwSQGXYIx245v2whqZcOo57FFBi/2RPGE1Uhcx4oq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XHFKW1lPmz4f3jkY; Mon, 30 Sep 2024 16:55:59 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id A4C2A1A092F; Mon, 30 Sep 2024 16:56:10 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCn28emZ_pmgEUMCw--.63034S9; Mon, 30 Sep 2024 16:56:10 +0800 (CST) From: Yu Kuai To: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH 5/5] blk-cgroup: use new helper blkg_print_dev_name() Date: Mon, 30 Sep 2024 16:53:02 +0800 Message-Id: <20240930085302.1558217-6-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930085302.1558217-1-yukuai1@huaweicloud.com> References: <20240930085302.1558217-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCn28emZ_pmgEUMCw--.63034S9 X-Coremail-Antispam: 1UD129KBjvJXoWxur4fCF18Jw4Uur4fKFy5XFb_yoW5uw1kpF WayFnIk34akFnrZ3WYqa47Z34rJw40q3yag393C34a9F17ur1IkF1jk3sYq34ruFyfJrs8 XFn0vFyUKF4UKwUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkE bVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67 AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI 42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCw CI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnI WIevJa73UjIFyTuYvjfUOyIUUUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai To avoid abuse of bdi_dev_name(), and remove blkg_dev_name() since it's not used anymore. Signed-off-by: Yu Kuai --- 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 bl= kg_policy_data *pd, [BLKG_RWSTAT_ASYNC] =3D "Async", [BLKG_RWSTAT_DISCARD] =3D "Discard", }; - const char *dname =3D blkg_dev_name(pd->blkg); u64 v; int i; =20 - if (!dname) + if (!pd->blkg->q->disk) return 0; =20 - for (i =3D 0; i < BLKG_RWSTAT_NR; i++) - seq_printf(sf, "%s %s %llu\n", dname, rwstr[i], - rwstat->cnt[i]); + for (i =3D 0; i < BLKG_RWSTAT_NR; i++) { + blkg_print_dev_name(sf, pd->blkg); + seq_printf(sf, " %s %llu\n", rwstr[i], rwstat->cnt[i]); + } =20 v =3D 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_stat= e *css, return 0; } =20 -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, u6= 4 v) { - const char *dname =3D blkg_dev_name(pd->blkg); - - if (!dname) + if (!blkg_print_dev_name(sf, pd->blkg)) return 0; =20 - 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 *b= lkg, struct seq_file *s) { struct blkg_iostat_set *bis =3D &blkg->iostat; u64 rbytes, wbytes, rios, wios, dbytes, dios; - const char *dname; unsigned seq; int i; =20 if (!blkg->online) return; =20 - dname =3D blkg_dev_name(blkg); - if (!dname) + if (!blkg_print_dev_name(s, blkg)) return; =20 - seq_printf(s, "%s ", dname); + seq_putc(s, ' '); =20 do { seq =3D 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 s= truct blkcg_policy *pol); void blkcg_deactivate_policy(struct gendisk *disk, const struct blkcg_policy *pol); =20 -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), --=20 2.39.2