Skip to content

Commit 72d6f02

Browse files
htejunaxboe
authored andcommitted
blk-mq: collapse __blk_mq_drain_queue() into blk_mq_freeze_queue()
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>
1 parent 780db20 commit 72d6f02

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

‎block/blk-mq.c‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,16 @@ static void blk_mq_queue_exit(struct request_queue *q)
108108
__percpu_counter_add(&q->mq_usage_counter, -1, 1000000);
109109
}
110110

111-
void blk_mq_drain_queue(struct request_queue *q)
111+
/*
112+
* Guarantee no request is in use, so we can change any data structure of
113+
* the queue afterward.
114+
*/
115+
void blk_mq_freeze_queue(struct request_queue *q)
112116
{
117+
spin_lock_irq(q->queue_lock);
118+
q->mq_freeze_depth++;
119+
spin_unlock_irq(q->queue_lock);
120+
113121
while (true) {
114122
s64 count;
115123

@@ -124,19 +132,6 @@ void blk_mq_drain_queue(struct request_queue *q)
124132
}
125133
}
126134

127-
/*
128-
* Guarantee no request is in use, so we can change any data structure of
129-
* the queue afterward.
130-
*/
131-
void blk_mq_freeze_queue(struct request_queue *q)
132-
{
133-
spin_lock_irq(q->queue_lock);
134-
q->mq_freeze_depth++;
135-
spin_unlock_irq(q->queue_lock);
136-
137-
blk_mq_drain_queue(q);
138-
}
139-
140135
static void blk_mq_unfreeze_queue(struct request_queue *q)
141136
{
142137
bool wake = false;

0 commit comments

Comments
 (0)