Re: [PATCH 1/4] block: blk-mq: support draining mq queue
From: Christoph Hellwig
Date: Mon Dec 23 2013 - 11:24:53 EST
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/