From: Shaohua Li <[email-masked]>

My SSD speed of direct write is about 80m/s, while I test page writeback,
the speed can only go to 68m/s. Below patch fixes this.
cfq_should_idle means a queue should idle because it's seekless sync
queue or it's the last queue, which is to maintain service tree time
slice. As currently async queues are all in root group, no idle for async
queue doesn't lose group slice fairness. If the last queue is asyn queue,
we definitely shouldn't stop dispatch requests because of pending async
requests, which will make cfq_may_dispatch able to dispatch more requests.

Signed-off-by: Shaohua Li <[email-masked]>

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 918c7fd..ce608a0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1803,7 +1803,7 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 	 * Otherwise, we do only if they are the last ones
 	 * in their service tree.
 	 */
-	return service_tree->count == 1;
+	return service_tree->count == 1 && cfqq_type(cfqq) != ASYNC_WORKLOAD;
 }
 
 static void cfq_arm_slice_timer(struct cfq_data *cfqd)