Skip to content

Commit

Permalink
blk-mq: collapse __blk_mq_drain_queue() into blk_mq_freeze_queue()
Browse files Browse the repository at this point in the history
Keeping __blk_mq_drain_queue() as a separate function doesn't buy us
anything and it's gonna be further simplified.  Let's flatten it into
its caller.

This patch doesn't make any functional change.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Jul 1, 2014
1 parent 780db20 commit 72d6f02
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,16 @@ static void blk_mq_queue_exit(struct request_queue *q)
__percpu_counter_add(&q->mq_usage_counter, -1, 1000000);
}

void blk_mq_drain_queue(struct request_queue *q)
/*
* Guarantee no request is in use, so we can change any data structure of
* the queue afterward.
*/
void blk_mq_freeze_queue(struct request_queue *q)
{
spin_lock_irq(q->queue_lock);
q->mq_freeze_depth++;
spin_unlock_irq(q->queue_lock);

while (true) {
s64 count;

Expand All @@ -124,19 +132,6 @@ void blk_mq_drain_queue(struct request_queue *q)
}
}

/*
* Guarantee no request is in use, so we can change any data structure of
* the queue afterward.
*/
void blk_mq_freeze_queue(struct request_queue *q)
{
spin_lock_irq(q->queue_lock);
q->mq_freeze_depth++;
spin_unlock_irq(q->queue_lock);

blk_mq_drain_queue(q);
}

static void blk_mq_unfreeze_queue(struct request_queue *q)
{
bool wake = false;
Expand Down

0 comments on commit 72d6f02

Please sign in to comment.