mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] block: blk-mq: support draining mq queue
Date: Mon, 23 Dec 2013 08:24:42 -0800	[thread overview]
Message-ID: <20131223162442.GA9383@infradead.org> (raw)
In-Reply-To: <1387815539-12257-2-git-send-email-tom.leiming@gmail.com>

On Tue, Dec 24, 2013 at 12:18:56AM +0800, Ming Lei wrote:
> blk_mq_drain_queue() is introduced so that we can drain
> mq queue during cleanup queue.
> 
> Also don't accept new requests any more if queue is marked
> as dying.

blk_cleanup_queue is a call from the LLDD, there is no need to make
it handle the MQ case.  However given that there might be a lot of
code shared between blk_cleanup_queue and blk_mq_cleanup_queue an
internal helper might be useful.

> +	if (q->mq_ops) {
> +		blk_mq_drain_queue(q);
> +	} else {
> +		spin_lock_irq(lock);
> +		__blk_drain_queue(q, true);
> +		queue_flag_set(QUEUE_FLAG_DEAD, q);
> +		spin_unlock_irq(lock);
> +	}

Why doesn't the mq case set QUEUE_FLAG_DEAD here?

> -static void blk_mq_freeze_queue(struct request_queue *q)
> +static void __blk_mq_freeze_queue(struct request_queue *q,
> +		bool force_drain)
>  {
>  	bool drain;
>  
> +	if (force_drain)
> +		goto do_drain;
> +
>  	spin_lock_irq(q->queue_lock);
>  	drain = !q->bypass_depth++;
>  	queue_flag_set(QUEUE_FLAG_BYPASS, q);
> @@ -134,6 +141,7 @@ static void blk_mq_freeze_queue(struct request_queue *q)
>  	if (!drain)
>  		return;
>  
> + do_drain:
>  	while (true) {
>  		s64 count;

This begs to be split into two functions, one that forces the drain, and
once that wraps it.

Also blk_execute_rq_nowait now needs to check the dying case for MQ as
well.

  reply	other threads:[~2013-12-23 16:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-23 16:18 [PATCH 0/4] block: blk-mq: support blk_cleanup_queue on mq Ming Lei
2013-12-23 16:18 ` [PATCH 1/4] block: blk-mq: support draining mq queue Ming Lei
2013-12-23 16:24   ` Christoph Hellwig [this message]
2013-12-24  3:30     ` Ming Lei
2013-12-26  9:45       ` Christoph Hellwig
2013-12-26 10:12         ` Ming Lei
2013-12-26 10:53           ` Christoph Hellwig
2013-12-23 16:18 ` [PATCH 2/4] block: blk-mq: make blk_sync_queue support mq Ming Lei
2013-12-23 16:25   ` Christoph Hellwig
2013-12-24  3:35     ` Ming Lei
2013-12-23 16:18 ` [PATCH 3/4] block: null_blk: fix queue leak inside removing device Ming Lei
2013-12-23 16:26   ` Christoph Hellwig
2013-12-23 16:18 ` [PATCH 4/4] block: blk-mq: don't export blk_mq_free_queue() Ming Lei
2013-12-23 16:27   ` Christoph Hellwig

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=20131223162442.GA9383@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tom.leiming@gmail.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

all inboxes | Powered by JetHome®