linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/bfq_wf2q: correct weight to ioprio
@ 2022-01-07  6:58 gaoyahu19
  2022-01-19 14:56 ` Paolo Valente
  2022-02-17  2:51 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: gaoyahu19 @ 2022-01-07  6:58 UTC (permalink / raw)
  To: paolo.valente, axboe; +Cc: linux-block, Yahu Gao

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-17  2:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07  6:58 [PATCH] block/bfq_wf2q: correct weight to ioprio gaoyahu19
2022-01-19 14:56 ` Paolo Valente
2022-02-03  3:18   ` Yahu Gao
2022-02-17  2:51 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).