linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Jens Axboe <axboe@fb.com>,
	linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH V4 1/3] blk-mq: move actual issue into one helper
Date: Tue, 16 Jan 2018 09:36:16 +0800	[thread overview]
Message-ID: <20180116013615.GC3213@ming.t460p> (raw)
In-Reply-To: <20180115171547.GA24260@redhat.com>

On Mon, Jan 15, 2018 at 12:15:47PM -0500, Mike Snitzer wrote:
> On Mon, Jan 15 2018 at 11:58am -0500,
> Ming Lei <ming.lei@redhat.com> wrote:
> 
> > No functional change, just to clean up code a bit, so that the following
> > change of using direct issue for blk_mq_request_bypass_insert() which is
> > needed by DM can be easier to do.
> > 
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  block/blk-mq.c | 39 +++++++++++++++++++++++++++------------
> >  1 file changed, 27 insertions(+), 12 deletions(-)
> > 
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index edb1291a42c5..bf8d6651f40e 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -1696,15 +1696,37 @@ static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq)
> >  	return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true);
> >  }
> >  
> > -static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
> > -					struct request *rq,
> > -					blk_qc_t *cookie)
> > +static blk_status_t __blk_mq_issue_req(struct blk_mq_hw_ctx *hctx,
> > +				       struct request *rq,
> > +				       blk_qc_t *new_cookie)
> >  {
> > +	blk_status_t ret;
> >  	struct request_queue *q = rq->q;
> >  	struct blk_mq_queue_data bd = {
> >  		.rq = rq,
> >  		.last = true,
> >  	};
> > +
> > +	if (!blk_mq_get_driver_tag(rq, NULL, false))
> > +		return BLK_STS_AGAIN;
> > +
> > +	if (!blk_mq_get_dispatch_budget(hctx)) {
> > +		blk_mq_put_driver_tag(rq);
> > +		return BLK_STS_AGAIN;
> > +	}
> > +
> > +	*new_cookie = request_to_qc_t(hctx, rq);
> > +
> > +	ret = q->mq_ops->queue_rq(hctx, &bd);
> > +
> > +	return ret;
> > +}
> > +
> > +static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
> > +					struct request *rq,
> > +					blk_qc_t *cookie)
> > +{
> > +	struct request_queue *q = rq->q;
> >  	blk_qc_t new_cookie;
> >  	blk_status_t ret;
> >  	bool run_queue = true;
> > @@ -1718,22 +1740,15 @@ static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
> >  	if (q->elevator)
> >  		goto insert;
> >  
> > -	if (!blk_mq_get_driver_tag(rq, NULL, false))
> > +	ret = __blk_mq_issue_req(hctx, rq, &new_cookie);
> > +	if (ret == BLK_STS_AGAIN)
> >  		goto insert;
> 
> You're (ab)using BLK_STS_AGAIN as a means to an end...
> But what if in the future q->mq_ops->queue_rq() returns BLK_STS_AGAIN?

Yeah, but now only dio uses that, so I let Jens decide it.

-- 
Ming

  reply	other threads:[~2018-01-16  1:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15 16:58 [PATCH V4 0/3] blk-mq: issue request directly for blk_insert_cloned_request Ming Lei
2018-01-15 16:58 ` [PATCH V4 1/3] blk-mq: move actual issue into one helper Ming Lei
2018-01-15 17:15   ` Mike Snitzer
2018-01-16  1:36     ` Ming Lei [this message]
2018-01-15 17:29   ` Jens Axboe
2018-01-15 19:41     ` Mike Snitzer
2018-01-16  1:43       ` Ming Lei
2018-01-16  1:45         ` Mike Snitzer
2018-01-16  1:40     ` Ming Lei
2018-01-16  4:05       ` Ming Lei
2018-01-15 16:58 ` [PATCH V4 2/3] blk-mq: return dispatch result to caller in blk_mq_try_issue_directly Ming Lei
2018-01-15 16:58 ` [PATCH V4 3/3] blk-mq: issue request directly for blk_insert_cloned_request Ming Lei
2018-01-16  1:34   ` Mike Snitzer
2018-01-15 17:43 ` [PATCH V4 0/3] " Mike Snitzer
2018-01-16  1:57   ` Ming Lei
2018-01-16 15:01     ` [for-4.16 PATCH v4-mike 1/2] blk-mq: return dispatch result from blk_mq_try_issue_directly Mike Snitzer
2018-01-16 15:01     ` [for-4.16 PATCH v4-mike 2/2] blk-mq: issue request directly for blk_insert_cloned_request Mike Snitzer
2018-01-16 16:41       ` Mike Snitzer
2018-01-16 17:20       ` Jens Axboe
2018-01-16 17:38         ` Mike Snitzer
2018-01-16 17:41           ` Jens Axboe
2018-01-16 18:16             ` Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180116013615.GC3213@ming.t460p \
    --to=ming.lei@redhat.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).