|email@example.com <firstname.lastname@example.org>||2011-05-06 11:34:41 -0600|
|committer||Jens Axboe <email@example.com>||2011-05-06 11:36:25 -0600|
block: hold queue if flush is running for non-queueable flush drive
In some drives, flush requests are non-queueable. When flush request is running, normal read/write requests can't run. If block layer dispatches such request, driver can't handle it and requeue it. Tejun suggested we can hold the queue when flush is running. This can avoid unnecessary requeue. Also this can improve performance. For example, we have request flush1, write1, flush 2. flush1 is dispatched, then queue is hold, write1 isn't inserted to queue. After flush1 is finished, flush2 will be dispatched. Since disk cache is already clean, flush2 will be finished very soon, so looks like flush2 is folded to flush1. In my test, the queue holding completely solves a regression introduced by commit 53d63e6b0dfb95882ec0219ba6bbd50cde423794: block: make the flush insertion use the tail of the dispatch list It's not a preempt type request, in fact we have to insert it behind requests that do specify INSERT_FRONT. which causes about 20% regression running a sysbench fileio workload. Stable: 2.6.39 only Cc: firstname.lastname@example.org Signed-off-by: Shaohua Li <email@example.com> Acked-by: Tejun Heo <firstname.lastname@example.org> Signed-off-by: Jens Axboe <email@example.com>
Diffstat (limited to 'block/blk-flush.c')
1 files changed, 11 insertions, 5 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 6c9b5e189e6..bb21e4c36f7 100644
@@ -212,13 +212,19 @@ static void flush_end_io(struct request *flush_rq, int error)
- * Moving a request silently to empty queue_head may stall the
- * queue. Kick the queue in those cases. This function is called
- * from request completion path and calling directly into
- * request_fn may confuse the driver. Always use kblockd.
+ * Kick the queue to avoid stall for two cases:
+ * 1. Moving a request silently to empty queue_head may stall the
+ * queue.
+ * 2. When flush request is running in non-queueable queue, the
+ * queue is hold. Restart the queue after flush request is finished
+ * to avoid stall.
+ * This function is called from request completion path and calling
+ * directly into request_fn may confuse the driver. Always use
+ * kblockd.
- if (queued)
+ if (queued || q->flush_queue_delayed)
+ q->flush_queue_delayed = 0;