From: Mike Christie <[email protected]>

These are fundamentally different operations, so keep them separate.

[hch: split up and reworded the changelog]

Signed-off-by: Mike Christie <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
---
 block/blk-flush.c |    1 +
 block/blk-mq.c    |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/blk-flush.c b/block/blk-flush.c
index c56c37d..d835243 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -232,6 +232,7 @@ static void flush_end_io(struct request *flush_rq, int 
error)
 
        if (q->mq_ops) {
                blk_mq_finish_request(flush_rq, error);
+               blk_mq_free_request(flush_rq);
                spin_lock_irqsave(&q->mq_flush_lock, flags);
        }
        running = &q->flush_queue[q->flush_running_idx];
diff --git a/block/blk-mq.c b/block/blk-mq.c
index d2e568e..9c32719 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -300,7 +300,6 @@ void blk_mq_finish_request(struct request *rq, int error)
 
        blk_account_io_completion(rq, bytes);
        blk_account_io_done(rq);
-       blk_mq_free_request(rq);
 }
 
 void blk_mq_complete_request(struct request *rq, int error)
@@ -313,8 +312,10 @@ void blk_mq_complete_request(struct request *rq, int error)
         */
        if (rq->end_io)
                rq->end_io(rq, error);
-       else
+       else {
                blk_mq_finish_request(rq, error);
+               blk_mq_free_request(rq);
+       }
 
 }
 
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to