@@ -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
*/
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(+)