Re: [PATCH 2/3] blk-mq: remove RQF_ELVPRIV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 18, 2023 at 07:31:00AM +0200, Christoph Hellwig wrote:
> RQF_ELVPRIV is set for all non-flush requests that have RQF_ELV set.
> Expand this condition in the two users of the flag and remove it.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  block/blk-mq-debugfs.c | 1 -
>  block/blk-mq-sched.h   | 4 ++--
>  block/blk-mq.c         | 6 ++----
>  include/linux/blk-mq.h | 2 --
>  4 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
> index d23a8554ec4aeb..588b7048342bee 100644
> --- a/block/blk-mq-debugfs.c
> +++ b/block/blk-mq-debugfs.c
> @@ -248,7 +248,6 @@ static const char *const rqf_name[] = {
>  	RQF_NAME(DONTPREP),
>  	RQF_NAME(FAILED),
>  	RQF_NAME(QUIET),
> -	RQF_NAME(ELVPRIV),
>  	RQF_NAME(IO_STAT),
>  	RQF_NAME(PM),
>  	RQF_NAME(HASHED),
> diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
> index 7c3cbad17f3052..4d8d2cd3b47396 100644
> --- a/block/blk-mq-sched.h
> +++ b/block/blk-mq-sched.h
> @@ -58,11 +58,11 @@ static inline void blk_mq_sched_completed_request(struct request *rq, u64 now)
>  
>  static inline void blk_mq_sched_requeue_request(struct request *rq)
>  {
> -	if (rq->rq_flags & RQF_ELV) {
> +	if ((rq->rq_flags & RQF_ELV) && !op_is_flush(rq->cmd_flags)) {
>  		struct request_queue *q = rq->q;
>  		struct elevator_queue *e = q->elevator;
>  
> -		if ((rq->rq_flags & RQF_ELVPRIV) && e->type->ops.requeue_request)
> +		if (e->type->ops.requeue_request)
>  			e->type->ops.requeue_request(rq);

The above actually changes current behavior since RQF_ELVPRIV is only set
iff the following condition is true:

	(rq->rq_flags & RQF_ELV) && !op_is_flush(rq->cmd_flags) &&
		e->type->ops.prepare_request.

>  	}
>  }
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 8b7e4daaa5b70d..7470c6636dc4f7 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -393,10 +393,8 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
>  		RB_CLEAR_NODE(&rq->rb_node);
>  
>  		if (!op_is_flush(data->cmd_flags) &&
> -		    e->type->ops.prepare_request) {
> +		    e->type->ops.prepare_request)
>  			e->type->ops.prepare_request(rq);
> -			rq->rq_flags |= RQF_ELVPRIV;
> -		}
>  	}
>  
>  	return rq;
> @@ -696,7 +694,7 @@ void blk_mq_free_request(struct request *rq)
>  	struct request_queue *q = rq->q;
>  	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
>  
> -	if ((rq->rq_flags & RQF_ELVPRIV) &&
> +	if ((rq->rq_flags & RQF_ELV) && !op_is_flush(rq->cmd_flags) &&
>  	    q->elevator->type->ops.finish_request)
>  		q->elevator->type->ops.finish_request(rq);

Same with above.

Thanks,
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux