Re: [PATCH v2 1/1] blk-mq: fill header with kernel-doc

From: Gabriel Krisman Bertazi
Date: Tue Oct 08 2019 - 14:46:49 EST


Bart Van Assche <bvanassche@xxxxxxx> writes:

> On 10/8/19 9:35 AM, Gabriel Krisman Bertazi wrote:
>> Andrà Almeida <andrealmeid@xxxxxxxxxxxxx> writes:
>>
>>> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
>>> index e0fce93ac127..8b745f229789 100644
>>> --- a/include/linux/blk-mq.h
>>> +++ b/include/linux/blk-mq.h
>>> @@ -10,74 +10,153 @@ struct blk_mq_tags;
>>> struct blk_flush_queue;
>>> /**
>>> - * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware block device
>>> + * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware
>>> + * block device
>>> */
>>> struct blk_mq_hw_ctx {
>>> struct {
>>> + /** @lock: Lock for accessing dispatch queue */
>>> spinlock_t lock;
>>> + /**
>>> + * @dispatch: Queue of dispatched requests, waiting for
>>> + * workers to send them to the hardware.
>>> + */
>>
>> It's been a few years since I looked at the block layer, but isn't
>> this used to hold requests that were taken from the blk_mq_ctx, but
>> couldn't be dispatched because the queue was full?
>
> I don't think so. I think that you are looking for the requeue_list
> member of struct request_queue.
>

Hmm, sorry, but I'm confused. I'm sure I'm missing something simple,
since I haven't touched this in a while, so maybe you can quickly point
me in the right direction?

I see blk_mq_requeue_request() being used by device drivers to retry
requests that failed, but if I read the code correctly, the flushed
queue seems to be moved to hctx->dispatch when the device
driver returned BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE to
blk_mq_dispatch_rq_list(). I thought BLK_STS_RESOURCE was returned by
the driver on .queue_rq() to signal there was no more resources on the
hardware to service further requests.

--
Gabriel Krisman Bertazi