Re: [PATCH RFC 03/39] mmc: block: Introduce queue semantics

Linus Walleij
2017-02-15T12:29:24Z

On Fri, Feb 10, 2017 at 1:55 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:

> Change from viewing the requests in progress as 'current' and 'previous',
> to viewing them as a queue. The current request is allocated to the first
> free slot. The presence of incomplete requests is determined from the
> count (mq->qcnt) of entries in the queue. Non-read-write requests (i.e.
> discards and flushes) are not added to the queue at all and require no
> special handling. Also no special handling is needed for the
> MMC_BLK_NEW_REQUEST case.
>
> As well as allowing an arbitrarily sized queue, the queue thread function
> is significantly simpler.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

This patch appears to be doing the same thing as my patch
"mmc: queue: get/put struct mmc_queue_req"

I just happen to feel that mmc_queue_req_get() vs
mmc_queue_req_put() is a more intuitive naming. If I wanted to
be overspecific I would say "mmc_queue_req_pool_get()"
and "mmc_queue_req_pool_put()".

On top of that, this patch adds the task_id and qcount business
to see if things are complete. This is closely related to the
mechanism of a polling loop that my patch set is getting us
rid of: I stop issueing NULL requests altogether and this
way we get rid of a big chunk of the problems you are
addressing here, like this:

> - if (mq->mqrq_prev->req)
> + if (mq->qcnt)
> cntx->is_waiting_last_req = true;
(...)
> - if (req || mq->mqrq_prev->req) {
> - bool req_is_special = mmc_req_is_special(req);
> -
> + if (req || mq->qcnt) {

As you will see, I take it further, the above will become just:
if (req).

Yours,
Linus Walleij