Linux Device Mapper development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Paolo Valente <paolo.valente@linaro.org>,
	Bart Van Assche <Bart.VanAssche@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	dm-devel@redhat.com
Subject: Re: [PATCH] block: directly insert blk-mq request from blk_insert_cloned_request()
Date: Fri, 8 Sep 2017 15:50:07 -0600	[thread overview]
Message-ID: <49cc6184-48da-2a45-e50e-13430e14e197@kernel.dk> (raw)
In-Reply-To: <20170908214236.GA49918@redhat.com>

On 09/08/2017 03:42 PM, Mike Snitzer wrote:
> diff --git a/block/blk-core.c b/block/blk-core.c
> index d709c0e..7a06b2b 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2342,7 +2342,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
>  	if (q->mq_ops) {
>  		if (blk_queue_io_stat(q))
>  			blk_account_io_start(rq, true);
> -		blk_mq_sched_insert_request(rq, false, true, false, false);
> +		blk_mq_insert_request(rq);
>  		return BLK_STS_OK;
>  	}

I think this is fine, since only dm uses this function. Would be nice to
have some check though, to ensure it doesn't get misused in the future.

> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 3f18cff..5c5bb3f 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1401,6 +1401,24 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  	blk_mq_hctx_mark_pending(hctx, ctx);
>  }
>  
> +static inline void blk_mq_queue_io(struct blk_mq_hw_ctx *hctx,
> +				   struct blk_mq_ctx *ctx,
> +				   struct request *rq)
> +{
> +	spin_lock(&ctx->lock);
> +	__blk_mq_insert_request(hctx, rq, false);
> +	spin_unlock(&ctx->lock);
> +}

Any particular reason it isn't just added to the dispatch queue?

> +void blk_mq_insert_request(struct request *rq)
> +{
> +	struct blk_mq_ctx *ctx = rq->mq_ctx;
> +	struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(rq->q, ctx->cpu);
> +
> +	blk_mq_queue_io(hctx, ctx, rq);
> +	blk_mq_run_hw_queue(hctx, false);
> +}

Would probably be cleaner as blk_mq_insert_and_run_request() or
something, to make sure it's understood that it also runs the queue.

-- 
Jens Axboe

  reply	other threads:[~2017-09-08 21:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1503611578.2899.69.camel@wdc.com>
     [not found] ` <AE77899A-0365-4C7C-91E4-5ACCC396B26B@linaro.org>
     [not found]   ` <ED23C7AC-F202-40E3-8421-E714BF446399@linaro.org>
     [not found]     ` <1504620914.4135.11.camel@wdc.com>
2017-09-07 15:52       ` BFQ + dm-mpath Mike Snitzer
2017-09-08  9:13         ` Paolo Valente
2017-09-08 16:41           ` [PATCH] dm mpath: switch IO scheduler of underlying paths to "none" [was: Re: BFQ + dm-mpath] Mike Snitzer
2017-09-08 16:48             ` Jens Axboe
2017-09-08 17:07               ` Mike Snitzer
2017-09-08 19:58                 ` Mike Snitzer
2017-09-08 20:28                   ` Jens Axboe
2017-09-08 21:42                     ` [PATCH] block: directly insert blk-mq request from blk_insert_cloned_request() Mike Snitzer
2017-09-08 21:50                       ` Jens Axboe [this message]
2017-09-08 22:03                         ` Mike Snitzer
2017-09-11 16:16                           ` [PATCH v2] " Mike Snitzer
2017-09-11 20:51                             ` Jens Axboe
2017-09-11 21:13                               ` Mike Snitzer
2017-09-11 21:27                                 ` Jens Axboe
2017-09-11 21:51                                   ` Mike Snitzer
2017-09-11 22:30                                     ` Mike Snitzer
2017-09-11 22:43                                       ` Jens Axboe
2017-09-14 15:57                                   ` Ming Lei
2017-09-14 16:30                                     ` Jens Axboe
2017-09-14 16:33                                       ` Ming Lei
2017-09-14 16:34                                         ` Jens Axboe

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=49cc6184-48da-2a45-e50e-13430e14e197@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Bart.VanAssche@wdc.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.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