[PATCH 3/5] blk-mq: always complete bios in blk_mq_complete_request

From: Christoph Hellwig
Date: Sun Oct 06 2013 - 11:24:32 EST


From: Mike Christie <michaelc@xxxxxxxxxxx>

Complete bios for all requests going through blk_mq_complete_request.

This mirrors the old I/O path and avoids blk-mq special casing in every
->end_io handler.

[hch: split up and reworded the changelog]

Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
block/blk-flush.c | 1 -
block/blk-mq.c | 13 ++++---------
block/blk-mq.h | 1 -
3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/block/blk-flush.c b/block/blk-flush.c
index d835243..3e4cc9c 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -231,7 +231,6 @@ static void flush_end_io(struct request *flush_rq, int error)
unsigned long flags = 0;

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);
}
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9c32719..c137541 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -284,7 +284,7 @@ static void blk_mq_bio_endio(struct request *rq, struct bio *bio, int error)
bio_endio(bio, error);
}

-void blk_mq_finish_request(struct request *rq, int error)
+static void blk_mq_finish_request(struct request *rq, int error)
{
struct bio *bio = rq->bio;
unsigned int bytes = 0;
@@ -306,17 +306,12 @@ void blk_mq_complete_request(struct request *rq, int error)
{
trace_block_rq_complete(rq->q, rq);

- /*
- * If ->end_io is set, it's responsible for doing the rest of the
- * completion.
- */
+ blk_mq_finish_request(rq, error);
+
if (rq->end_io)
rq->end_io(rq, error);
- else {
- blk_mq_finish_request(rq, error);
+ else
blk_mq_free_request(rq);
- }
-
}

void __blk_mq_end_io(struct request *rq, int error)
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 42d0110..52bf1f9 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -27,7 +27,6 @@ void blk_mq_complete_request(struct request *rq, int error);
void blk_mq_run_request(struct request *rq, bool run_queue, bool async);
void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
void blk_mq_init_flush(struct request_queue *q);
-void blk_mq_finish_request(struct request *rq, int error);

/*
* CPU hotplug helpers
--
1.7.10.4


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