diff mbox series

block/bfq_wf2q: correct weight to ioprio

Message ID 20220107065859.25689-1-gaoyahu19@gmail.com (mailing list archive)
State New, archived
Headers show
Series block/bfq_wf2q: correct weight to ioprio | expand

Commit Message

Yahu Gao Jan. 7, 2022, 6:58 a.m. UTC
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>

Comments

Paolo Valente Jan. 19, 2022, 2:56 p.m. UTC | #1
> Il giorno 7 gen 2022, alle ore 07:58, gaoyahu19@gmail.com ha scritto:
> 
> 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>
> 

Thanks for spotting this error!

Acked-by: Paolo Valente <paolo.valente@linaro.org>

> 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
>
Yahu Gao Feb. 3, 2022, 3:18 a.m. UTC | #2
On 2022/1/19 10:56 下午, Paolo Valente wrote:
>
>> Il giorno 7 gen 2022, alle ore 07:58, gaoyahu19@gmail.com ha scritto:
>>
>> 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>
>>
> Thanks for spotting this error!
>
> Acked-by: Paolo Valente <paolo.valente@linaro.org>
friendly ping...
>> 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
>>
Jens Axboe Feb. 17, 2022, 2:51 a.m. UTC | #3
On Fri, 7 Jan 2022 14:58:59 +0800, gaoyahu19@gmail.com wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] block/bfq_wf2q: correct weight to ioprio
      commit: c766ace687d7ba1cbb485759f19ef33b35fb1b4a

Best regards,
diff mbox series

Patch

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)