History

block: cleanup ioc_clear_queue

Fold __ioc_clear_queue into ioc_clear_queue and switch to always use plain _irq locking instead of the more expensive _irqsave that is not needed here.

Christoph Hellwig committed 4 years ago

Commit 091abcb1 parent edf70ff1 file · +11 −22Browse files

Unified · Split

block/blk-ioc.c+11−22
@@ -192,27 +192,6 @@ void exit_io_context(struct task_struct *task) · 191 unmodified lines
192192 }
193193 }
194194
195−static void __ioc_clear_queue(struct list_head *icq_list)
196−{
197− unsigned long flags;
198−
199− rcu_read_lock();
200− while (!list_empty(icq_list)) {
201− struct io_cq *icq = list_entry(icq_list->next,
202− struct io_cq, q_node);
203− struct io_context *ioc = icq->ioc;
204−
205− spin_lock_irqsave(&ioc->lock, flags);
206− if (icq->flags & ICQ_DESTROYED) {
207− spin_unlock_irqrestore(&ioc->lock, flags);
208− continue;
209− }
210− ioc_destroy_icq(icq);
211− spin_unlock_irqrestore(&ioc->lock, flags);
212− }
213− rcu_read_unlock();
214−}
215−
216195 /**
217196 * ioc_clear_queue - break any ioc association with the specified queue
218197 * @q: request_queue being cleared
@@ -227,7 +206,17 @@ void ioc_clear_queue(struct request_queue *q) · 8 unmodified lines
227206 list_splice_init(&q->icq_list, &icq_list);
228207 spin_unlock_irq(&q->queue_lock);
229208
230− __ioc_clear_queue(&icq_list);
209+ rcu_read_lock();
210+ while (!list_empty(&icq_list)) {
211+ struct io_cq *icq =
212+ list_entry(icq_list.next, struct io_cq, q_node);
213+
214+ spin_lock_irq(&icq->ioc->lock);
215+ if (!(icq->flags & ICQ_DESTROYED))
216+ ioc_destroy_icq(icq);
217+ spin_unlock_irq(&icq->ioc->lock);
218+ }
219+ rcu_read_unlock();
231220 }
232221
233222 static struct io_context *alloc_io_context(gfp_t gfp_flags, int node)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t