diff mbox series

[1/2] blk-ioprio: remove ioprio_blkcg_from_bio()

Message ID 20240711090059.3998565-2-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series blk-ioprio: remove per-disk structure | expand

Commit Message

Yu Kuai July 11, 2024, 9 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Currently, if config is enabled, then ioprio is always enabeld by
default from blkcg_init_disk(), hence there is no point to check if
the policy is enabled from blkg in ioprio_blkcg_from_bio(). Hence remove
it and get blkcg directly from bio.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-ioprio.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Bart Van Assche July 11, 2024, 6 p.m. UTC | #1
On 7/11/24 2:00 AM, Yu Kuai wrote:
> Currently, if config is enabled, then ioprio is always enabeld by

enabeld -> enabled

> default from blkcg_init_disk(), hence there is no point to check if
> the policy is enabled from blkg in ioprio_blkcg_from_bio(). Hence remove
> it and get blkcg directly from bio.

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/block/blk-ioprio.c b/block/blk-ioprio.c
index 4051fada01f1..ae52b418e984 100644
--- a/block/blk-ioprio.c
+++ b/block/blk-ioprio.c
@@ -84,16 +84,6 @@  ioprio_blkcg_from_css(struct cgroup_subsys_state *css)
 	return blkcg_to_ioprio_blkcg(css_to_blkcg(css));
 }
 
-static struct ioprio_blkcg *ioprio_blkcg_from_bio(struct bio *bio)
-{
-	struct blkg_policy_data *pd = blkg_to_pd(bio->bi_blkg, &ioprio_policy);
-
-	if (!pd)
-		return NULL;
-
-	return blkcg_to_ioprio_blkcg(pd->blkg->blkcg);
-}
-
 static int ioprio_show_prio_policy(struct seq_file *sf, void *v)
 {
 	struct ioprio_blkcg *blkcg = ioprio_blkcg_from_css(seq_css(sf));
@@ -186,7 +176,7 @@  static struct blkcg_policy ioprio_policy = {
 
 void blkcg_set_ioprio(struct bio *bio)
 {
-	struct ioprio_blkcg *blkcg = ioprio_blkcg_from_bio(bio);
+	struct ioprio_blkcg *blkcg = blkcg_to_ioprio_blkcg(bio->bi_blkg->blkcg);
 	u16 prio;
 
 	if (!blkcg || blkcg->prio_policy == POLICY_NO_CHANGE)