Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285095
b: refs/heads/master
c: 481a7d6
h: refs/heads/master
i:
  285093: 352af87
  285091: bcdd0b4
  285087: 8f85c23
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Dec 13, 2011
1 parent bf310e5 commit 9403839
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34f6055c80285e4efb3f602a9119db75239744dc
refs/heads/master: 481a7d64790cd7ca61a8bbcbd9d017ce58e6fe39
24 changes: 18 additions & 6 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ EXPORT_SYMBOL(blk_put_queue);
void blk_drain_queue(struct request_queue *q, bool drain_all)
{
while (true) {
int nr_rqs;
bool drain = false;
int i;

spin_lock_irq(q->queue_lock);

Expand All @@ -368,14 +369,25 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)

__blk_run_queue(q);

if (drain_all)
nr_rqs = q->rq.count[0] + q->rq.count[1];
else
nr_rqs = q->rq.elvpriv;
drain |= q->rq.elvpriv;

/*
* Unfortunately, requests are queued at and tracked from
* multiple places and there's no single counter which can
* be drained. Check all the queues and counters.
*/
if (drain_all) {
drain |= !list_empty(&q->queue_head);
for (i = 0; i < 2; i++) {
drain |= q->rq.count[i];
drain |= q->in_flight[i];
drain |= !list_empty(&q->flush_queue[i]);
}
}

spin_unlock_irq(q->queue_lock);

if (!nr_rqs)
if (!drain)
break;
msleep(10);
}
Expand Down

0 comments on commit 9403839

Please sign in to comment.