blk-mq: don't count completed flush data request as inflight in case of quiesce
[linux-2.6-microblaze.git] / block / blk-mq.c
index 900c1be..ac18f80 100644 (file)
@@ -1512,14 +1512,26 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q,
 }
 EXPORT_SYMBOL(blk_mq_delay_kick_requeue_list);
 
+static bool blk_is_flush_data_rq(struct request *rq)
+{
+       return (rq->rq_flags & RQF_FLUSH_SEQ) && !is_flush_rq(rq);
+}
+
 static bool blk_mq_rq_inflight(struct request *rq, void *priv)
 {
        /*
         * If we find a request that isn't idle we know the queue is busy
         * as it's checked in the iter.
         * Return false to stop the iteration.
+        *
+        * In case of queue quiesce, if one flush data request is completed,
+        * don't count it as inflight given the flush sequence is suspended,
+        * and the original flush data request is invisible to driver, just
+        * like other pending requests because of quiesce
         */
-       if (blk_mq_request_started(rq)) {
+       if (blk_mq_request_started(rq) && !(blk_queue_quiesced(rq->q) &&
+                               blk_is_flush_data_rq(rq) &&
+                               blk_mq_request_completed(rq))) {
                bool *busy = priv;
 
                *busy = true;