All of lore.kernel.org
 help / color / mirror / Atom feed
From: gaoyahu19@gmail.com
To: paolo.valente@linaro.org, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, Yahu Gao <gaoyahu19@gmail.com>
Subject: [PATCH] block/bfq_wf2q: correct weight to ioprio
Date: Fri,  7 Jan 2022 14:58:59 +0800	[thread overview]
Message-ID: <20220107065859.25689-1-gaoyahu19@gmail.com> (raw)

From: Yahu Gao <gaoyahu19@gmail.com>

The return value is ioprio * BFQ_WEIGHT_CONVERSION_COEFF or 0.
What we want is ioprio or 0.
Correct this by changing the calculation.

Signed-off-by: Yahu Gao <gaoyahu19@gmail.com>

diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index b74cc0da118e..709b901de3ca 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -519,7 +519,7 @@ unsigned short bfq_ioprio_to_weight(int ioprio)
 static unsigned short bfq_weight_to_ioprio(int weight)
 {
 	return max_t(int, 0,
-		     IOPRIO_NR_LEVELS * BFQ_WEIGHT_CONVERSION_COEFF - weight);
+		     IOPRIO_NR_LEVELS - weight / BFQ_WEIGHT_CONVERSION_COEFF);
 }
 
 static void bfq_get_entity(struct bfq_entity *entity)
-- 
2.15.0


             reply	other threads:[~2022-01-07  7:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  6:58 gaoyahu19 [this message]
2022-01-19 14:56 ` [PATCH] block/bfq_wf2q: correct weight to ioprio Paolo Valente
2022-02-03  3:18   ` Yahu Gao
2022-02-17  2:51 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220107065859.25689-1-gaoyahu19@gmail.com \
    --to=gaoyahu19@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.