Re: [PATCH V9 2/4] blk-mq: refactor the code of issue request directly

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

 



On 12/5/18 12:44 AM, Jianchao Wang wrote:
> Merge blk_mq_try_issue_directly and __blk_mq_try_issue_directly
> into one interface to unify the interfaces to issue requests
> directly. The merged interface takes over the requests totally,
> it could insert, end or do nothing based on the return value of
> .queue_rq and 'bypass' parameter. Then caller needn't any other
> handling any more and then code could be cleaned up.
> 
> Signed-off-by: Jianchao Wang <jianchao.w.wang@xxxxxxxxxx>
> ---
>  block/blk-mq.c | 116 +++++++++++++++++++++++++++------------------------------
>  1 file changed, 54 insertions(+), 62 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 153af90..fe92e52 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1815,93 +1815,85 @@ static bool blk_rq_can_direct_dispatch(struct request *rq)
>  	return req_op(rq) == REQ_OP_READ || req_op(rq) == REQ_OP_WRITE;
>  }
>  
> -static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
> +static blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
>  						struct request *rq,
>  						blk_qc_t *cookie,
> -						bool bypass_insert, bool last)
> +						bool bypass, bool last)
>  {
>  	struct request_queue *q = rq->q;
>  	bool run_queue = true;
> +	blk_status_t ret = BLK_STS_RESOURCE;
> +	int srcu_idx;
>  	bool force = false;
>  
> +	if (!blk_rq_can_direct_dispatch(rq)) {
> +		/*
> +		 * Insert request to hctx dispatch list for 'bypass == true'
> +		 * case, otherwise, the caller will fail forever.
> +		 */
> +		if (bypass)
> +			force = true;
> +		goto out;
> +	}

Same here, of course.

Otherwise looks fine.

-- 
Jens Axboe




[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