diff mbox series

[RFC,4/7] blk-mq: add callback of .free_request

Message ID 20190712024726.1227-5-ming.lei@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series blk-mq: improvement on handling IO during CPU hotplug | expand

Commit Message

Ming Lei July 12, 2019, 2:47 a.m. UTC
blk_steal_bios() is usually used before freeing the request, however,
we have to tell driver that the un-completed request will be freed,
then driver can free any private part for the request.

Then we can apply blk_steal_bios() in other cases, such as freeing
the request and re-submit the stolen bios after the hctx is down
in CPU hotplug situation.

Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Keith Busch <keith.busch@intel.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/blk-mq.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index dc86bdac08f4..353606023a0f 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -141,6 +141,7 @@  typedef int (poll_fn)(struct blk_mq_hw_ctx *);
 typedef int (map_queues_fn)(struct blk_mq_tag_set *set);
 typedef bool (busy_fn)(struct request_queue *);
 typedef void (complete_fn)(struct request *);
+typedef void (free_request_fn)(struct request *);
 
 
 struct blk_mq_ops {
@@ -201,6 +202,12 @@  struct blk_mq_ops {
 	/* Called from inside blk_get_request() */
 	void (*initialize_rq_fn)(struct request *rq);
 
+	/*
+	 * Called before freeing one request which isn't completed yet,
+	 * and usually for freeing the driver private part
+	 */
+	free_request_fn		*free_request;
+
 	/*
 	 * If set, returns whether or not this queue currently is busy
 	 */