[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YSjoZ/cul4w2l8tG@T590>
Date: Fri, 27 Aug 2021 21:28:07 +0800
From: Ming Lei <ming.lei@...hat.com>
To: Niklas Cassel <Niklas.Cassel@....com>
Cc: Jens Axboe <axboe@...nel.dk>, Bart Van Assche <bvanassche@....org>,
Damien Le Moal <Damien.LeMoal@....com>,
Paolo Valente <paolo.valente@...aro.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 1/2] blk-mq: don't call callbacks for requests that
bypassed the scheduler
On Fri, Aug 27, 2021 at 12:41:31PM +0000, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@....com>
>
> Currently, __blk_mq_alloc_request() calls ops.prepare_request and sets
> RQF_ELVPRIV.
>
> Therefore, (if the request is not a flush) the RQF_ELVPRIV flag will be
> set for the request in blk_mq_submit_bio(), regardless if the request
> was submitted to a scheduler, or bypassed the scheduler.
>
> Later, blk_mq_free_request() checks if the RQF_ELVPRIV flag is set,
> if it is, the ops.finish_request callback will be called.
>
> The problem with this is that the finish_request scheduler callback
> will be called for requests that bypassed the scheduler.
>
> Fix this by calling the scheduler ops.prepare_request callback, and
> set the RQF_ELVPRIV flag only immediately before calling the insert
> callback.
One request could be inserted more than one times, such as requeue,
however __blk_mq_alloc_request() is just run once, so is it fine to
call ->prepare_request more than one time for same request?
Or I am wondering why not call ->prepare_request when the following
check is true?
if (e && e->type->ops.prepare_request && !op_is_flush(data->cmd_flags) &&
!blk_op_is_passthrough(data->cmd_flags))
e->type->ops.prepare_request()
Thanks,
Ming
Powered by blists - more mailing lists