Re: [PATCH V2 1/2] blk-mq: introduce blk_mq_complete_request_sync()

Ming Lei
2019-03-28T00:51:11Z

On Wed, Mar 27, 2019 at 07:32:45AM -0600, Keith Busch wrote:
> On Wed, Mar 27, 2019 at 04:51:13PM +0800, Ming Lei wrote:
> > @@ -594,8 +594,11 @@ static void __blk_mq_complete_request(struct request *rq)
> > /*
> > * For a polled request, always complete locallly, it's pointless
> > * to redirect the completion.
> > + *
> > + * If driver requires to complete the request synchronously,
> > + * complete it locally, and it is usually done in error handler.
> > */
> > - if ((rq->cmd_flags & REQ_HIPRI) ||
> > + if ((rq->cmd_flags & REQ_HIPRI) || sync ||
> > !test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags)) {
> > q->mq_ops->complete(rq);
> > return;
>
> I think this is fine and agree this is fixing a problem, but just
> considering an alternative: would it be okay to just temporarily clear
> QUEUE_FLAG_SAME_COMP in the necessary error handling that wants a sync
> completion so that we're not introducing an additional parameter?

But the flag can be changed by sysfs too.

Thanks,
Ming