linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] blk-mq: Return true if request was completed
@ 2018-11-14 16:25 Keith Busch
  2018-11-14 16:26 ` [PATCH 2/3] scsi: Do not rely on blk-mq for double completions Keith Busch
  2018-11-14 16:26 ` [PATCH 3/3] blk-mq: Simplify request completion state Keith Busch
  0 siblings, 2 replies; 8+ messages in thread
From: Keith Busch @ 2018-11-14 16:25 UTC (permalink / raw)
  To: linux-scsi, linux-block; +Cc: Jens Axboe, Keith Busch

A driver may have internal state to cleanup if we're pretending a request
timeout occured. Return 'false' if the command wasn't actually completed
due to the error injection, and true otherwise.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 block/blk-mq.c         | 5 +++--
 include/linux/blk-mq.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3f91c6e5b17a..f91951800a64 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -630,11 +630,12 @@ static void hctx_lock(struct blk_mq_hw_ctx *hctx, int *srcu_idx)
  *	Ends all I/O on a request. It does not handle partial completions.
  *	The actual completion happens out-of-order, through a IPI handler.
  **/
-void blk_mq_complete_request(struct request *rq)
+bool blk_mq_complete_request(struct request *rq)
 {
 	if (unlikely(blk_should_fake_timeout(rq->q)))
-		return;
+		return false;
 	__blk_mq_complete_request(rq);
+	return true;
 }
 EXPORT_SYMBOL(blk_mq_complete_request);
 
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 2286dc12c6bc..dec6ef385492 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -264,7 +264,7 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
 				bool kick_requeue_list);
 void blk_mq_kick_requeue_list(struct request_queue *q);
 void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
-void blk_mq_complete_request(struct request *rq);
+bool blk_mq_complete_request(struct request *rq);
 bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
 			   struct bio *bio);
 bool blk_mq_queue_stopped(struct request_queue *q);
-- 
2.14.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH 1/3] blk-mq: Return true if request was completed
@ 2018-11-15 17:56 Keith Busch
  2018-11-15 17:56 ` [PATCH 2/3] scsi: Do not rely on blk-mq for double completions Keith Busch
  0 siblings, 1 reply; 8+ messages in thread
From: Keith Busch @ 2018-11-15 17:56 UTC (permalink / raw)
  To: linux-scsi, linux-block
  Cc: Jens Axboe, Martin Petersen, Bart Van Assche, Keith Busch

A driver may have internal state to cleanup if we're pretending a request
timeout occured. Return 'false' if the command wasn't actually completed
due to the error injection, and true otherwise.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 block/blk-mq.c         | 5 +++--
 include/linux/blk-mq.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3f91c6e5b17a..f91951800a64 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -630,11 +630,12 @@ static void hctx_lock(struct blk_mq_hw_ctx *hctx, int *srcu_idx)
  *	Ends all I/O on a request. It does not handle partial completions.
  *	The actual completion happens out-of-order, through a IPI handler.
  **/
-void blk_mq_complete_request(struct request *rq)
+bool blk_mq_complete_request(struct request *rq)
 {
 	if (unlikely(blk_should_fake_timeout(rq->q)))
-		return;
+		return false;
 	__blk_mq_complete_request(rq);
+	return true;
 }
 EXPORT_SYMBOL(blk_mq_complete_request);
 
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 2286dc12c6bc..dec6ef385492 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -264,7 +264,7 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
 				bool kick_requeue_list);
 void blk_mq_kick_requeue_list(struct request_queue *q);
 void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
-void blk_mq_complete_request(struct request *rq);
+bool blk_mq_complete_request(struct request *rq);
 bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
 			   struct bio *bio);
 bool blk_mq_queue_stopped(struct request_queue *q);
-- 
2.14.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-15 18:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-14 16:25 [PATCH 1/3] blk-mq: Return true if request was completed Keith Busch
2018-11-14 16:26 ` [PATCH 2/3] scsi: Do not rely on blk-mq for double completions Keith Busch
2018-11-14 17:51   ` Bart Van Assche
2018-11-14 18:00     ` Keith Busch
2018-11-14 18:10       ` Keith Busch
2018-11-14 16:26 ` [PATCH 3/3] blk-mq: Simplify request completion state Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2018-11-15 17:56 [PATCH 1/3] blk-mq: Return true if request was completed Keith Busch
2018-11-15 17:56 ` [PATCH 2/3] scsi: Do not rely on blk-mq for double completions Keith Busch
2018-11-15 17:57   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).