blk-mq: Add a kick_requeue_list argument to blk_mq_requeue_request()
authorBart Van Assche <bart.vanassche@sandisk.com>
Sat, 29 Oct 2016 00:21:41 +0000 (17:21 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 2 Nov 2016 18:50:19 +0000 (12:50 -0600)
Most blk_mq_requeue_request() and blk_mq_add_to_requeue_list() calls
are followed by kicking the requeue list. Hence add an argument to
these two functions that allows to kick the requeue list. This was
proposed by Christoph Hellwig.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-flush.c
block/blk-mq.c
drivers/block/xen-blkfront.c
drivers/md/dm-rq.c
drivers/nvme/host/core.c
drivers/scsi/scsi_lib.c
include/linux/blk-mq.h

index d35beca18481671431283f66ce069f3df7083ef6..c486b7aa62eeb7eb51f617d8a589774a382278b6 100644 (file)
@@ -134,10 +134,7 @@ static void blk_flush_restore_request(struct request *rq)
 static bool blk_flush_queue_rq(struct request *rq, bool add_front)
 {
        if (rq->q->mq_ops) {
-               struct request_queue *q = rq->q;
-
-               blk_mq_add_to_requeue_list(rq, add_front);
-               blk_mq_kick_requeue_list(q);
+               blk_mq_add_to_requeue_list(rq, add_front, true);
                return false;
        } else {
                if (add_front)
index 3dc32354329389b3487517a86298ec30a984fe2c..8d3de5bd4d6f937c695f5ce8e456907c2e4cb045 100644 (file)
@@ -492,12 +492,12 @@ static void __blk_mq_requeue_request(struct request *rq)
        }
 }
 
-void blk_mq_requeue_request(struct request *rq)
+void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)
 {
        __blk_mq_requeue_request(rq);
 
        BUG_ON(blk_queued_rq(rq));
-       blk_mq_add_to_requeue_list(rq, true);
+       blk_mq_add_to_requeue_list(rq, true, kick_requeue_list);
 }
 EXPORT_SYMBOL(blk_mq_requeue_request);
 
@@ -531,7 +531,8 @@ static void blk_mq_requeue_work(struct work_struct *work)
        blk_mq_run_hw_queues(q, false);
 }
 
-void blk_mq_add_to_requeue_list(struct request *rq, bool at_head)
+void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
+                               bool kick_requeue_list)
 {
        struct request_queue *q = rq->q;
        unsigned long flags;
@@ -550,6 +551,9 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head)
                list_add_tail(&rq->queuelist, &q->requeue_list);
        }
        spin_unlock_irqrestore(&q->requeue_lock, flags);
+
+       if (kick_requeue_list)
+               blk_mq_kick_requeue_list(q);
 }
 EXPORT_SYMBOL(blk_mq_add_to_requeue_list);
 
index 71ca36eab558ed4e7a245f526c9b8d353451dd47..c000fdf048b224ff47d1067a71d0962264088be0 100644 (file)
@@ -2043,7 +2043,7 @@ static int blkif_recover(struct blkfront_info *info)
                /* Requeue pending requests (flush or discard) */
                list_del_init(&req->queuelist);
                BUG_ON(req->nr_phys_segments > segs);
-               blk_mq_requeue_request(req);
+               blk_mq_requeue_request(req, false);
        }
        blk_mq_start_stopped_hw_queues(info->rq, true);
        blk_mq_kick_requeue_list(info->rq);
index 060ccc5a4b1ceb6cd609e17c02fbc3178187efc8..315257959fc0de9bcfb3eb9701c6199363eb9462 100644 (file)
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(dm_mq_kick_requeue_list);
 
 static void dm_mq_delay_requeue_request(struct request *rq, unsigned long msecs)
 {
-       blk_mq_requeue_request(rq);
+       blk_mq_requeue_request(rq, false);
        __dm_mq_kick_requeue_list(rq->q, msecs);
 }
 
index a764c2aa00a11ce72abea0501bd146023046e67f..e8070e3cc7c756eab284daa1e6cb9ceb13ff7921 100644 (file)
@@ -203,7 +203,7 @@ void nvme_requeue_req(struct request *req)
 {
        unsigned long flags;
 
-       blk_mq_requeue_request(req);
+       blk_mq_requeue_request(req, false);
        spin_lock_irqsave(req->q->queue_lock, flags);
        if (!blk_queue_stopped(req->q))
                blk_mq_kick_requeue_list(req->q);
index 2b78ff12bf3cc9ab9917355c96a6fb3d9c9ee8ee..2e35132f8be17be0a070dfae66e98f3afc31d2dc 100644 (file)
@@ -86,10 +86,8 @@ scsi_set_blocked(struct scsi_cmnd *cmd, int reason)
 static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
 {
        struct scsi_device *sdev = cmd->device;
-       struct request_queue *q = cmd->request->q;
 
-       blk_mq_requeue_request(cmd->request);
-       blk_mq_kick_requeue_list(q);
+       blk_mq_requeue_request(cmd->request, true);
        put_device(&sdev->sdev_gendev);
 }
 
index ed20ac74c62a9a481adc0cdee441cc127ba1847f..35a0af5ede6d1e4e73727a01e5e2613dda203d46 100644 (file)
@@ -218,8 +218,9 @@ void blk_mq_start_request(struct request *rq);
 void blk_mq_end_request(struct request *rq, int error);
 void __blk_mq_end_request(struct request *rq, int error);
 
-void blk_mq_requeue_request(struct request *rq);
-void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
+void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
+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_abort_requeue_list(struct request_queue *q);