2019-09-30 20:42:14

by Pavel Begunkov

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] blk-mq: Inline request status checkers

On 30/09/2019 22:53, Bart Van Assche wrote:
> On 9/30/19 12:43 PM, Pavel Begunkov (Silence) wrote:
>> @@ -282,7 +282,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
>> * test and set the bit before assining ->rqs[].
>> */
>> rq = tags->rqs[bitnr];
>> - if (rq && blk_mq_request_started(rq))
>> + if (rq && blk_mq_rq_state(rq) != MQ_RQ_IDLE)
>> return iter_data->fn(rq, iter_data->data, reserved);
>>
>> return true>
>> @@ -360,7 +360,7 @@ static bool blk_mq_tagset_count_completed_rqs(struct request *rq,
>> {
>> unsigned *count = data;
>>
>> - if (blk_mq_request_completed(rq))
>> + if (blk_mq_rq_state(rq) == MQ_RQ_COMPLETE)
>> (*count)++;
>> return true;
>> }
>
> Changes like the above significantly reduce readability of the code in
> the block layer core. I don't like this. I think this patch is a step
> backwards instead of a step forwards.

Yep, looks too bulky.

Jens, could you consider the first version?


--
Yours sincerely,
Pavel Begunkov


Attachments:
signature.asc (849.00 B)
OpenPGP digital signature

2019-10-02 13:38:19

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] blk-mq: Inline request status checkers

On 9/30/19 2:12 PM, Pavel Begunkov wrote:
> On 30/09/2019 22:53, Bart Van Assche wrote:
>> On 9/30/19 12:43 PM, Pavel Begunkov (Silence) wrote:
>>> @@ -282,7 +282,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
>>> * test and set the bit before assining ->rqs[].
>>> */
>>> rq = tags->rqs[bitnr];
>>> - if (rq && blk_mq_request_started(rq))
>>> + if (rq && blk_mq_rq_state(rq) != MQ_RQ_IDLE)
>>> return iter_data->fn(rq, iter_data->data, reserved);
>>>
>>> return true>
>>> @@ -360,7 +360,7 @@ static bool blk_mq_tagset_count_completed_rqs(struct request *rq,
>>> {
>>> unsigned *count = data;
>>>
>>> - if (blk_mq_request_completed(rq))
>>> + if (blk_mq_rq_state(rq) == MQ_RQ_COMPLETE)
>>> (*count)++;
>>> return true;
>>> }
>>
>> Changes like the above significantly reduce readability of the code in
>> the block layer core. I don't like this. I think this patch is a step
>> backwards instead of a step forwards.
>
> Yep, looks too bulky.
>
> Jens, could you consider the first version?

Yes, first one is fine, I have applied it. Thanks.

--
Jens Axboe