[PATCH] blk-mq: always allow reserved allocation in hctx_may_queue

Christoph Hellwig hch at lst.de
Fri Sep 11 05:52:58 EDT 2020


On Fri, Sep 11, 2020 at 05:44:53PM +0800, Ming Lei wrote:
>  	unsigned int tag_offset = rq->mq_hctx->tags->nr_reserved_tags;
>  	int tag;
> +	bool reserved = blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags,
> +			rq->internal_tag);
>  
>  	blk_mq_tag_busy(rq->mq_hctx);
>  
> -	if (blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags, rq->internal_tag)) {
> +	if (reserved) {
>  		bt = rq->mq_hctx->tags->breserved_tags;
>  		tag_offset = 0;
>  	}
>  
> -	if (!hctx_may_queue(rq->mq_hctx, bt))
> +	if (!reserved && !hctx_may_queue(rq->mq_hctx, bt))

What about:

	if (blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags, rq->internal_tag)) {
  		bt = rq->mq_hctx->tags->breserved_tags;
  		tag_offset = 0;
	} else {
		if (!hctx_may_queue(rq->mq_hctx, bt))
	 		return false;
	}

which seems a little easier to follow?

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch at lst.de>



More information about the Linux-nvme mailing list