diff options
| -rw-r--r-- | block/blk-mq.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 1e324a123d40..22682fb4be65 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -108,8 +108,16 @@ static void blk_mq_queue_exit(struct request_queue *q) | |||
| 108 | __percpu_counter_add(&q->mq_usage_counter, -1, 1000000); | 108 | __percpu_counter_add(&q->mq_usage_counter, -1, 1000000); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 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) | ||
| 112 | { | 116 | { |
| 117 | spin_lock_irq(q->queue_lock); | ||
| 118 | q->mq_freeze_depth++; | ||
| 119 | spin_unlock_irq(q->queue_lock); | ||
| 120 | |||
| 113 | while (true) { | 121 | while (true) { |
| 114 | s64 count; | 122 | s64 count; |
| 115 | 123 | ||
| @@ -124,19 +132,6 @@ void blk_mq_drain_queue(struct request_queue *q) | |||
| 124 | } | 132 | } |
| 125 | } | 133 | } |
| 126 | 134 | ||
| 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 | |||
| 140 | static void blk_mq_unfreeze_queue(struct request_queue *q) | 135 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
| 141 | { | 136 | { |
| 142 | bool wake = false; | 137 | bool wake = false; |
