]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: core: Only kick the requeue list if necessary
authorBart Van Assche <bvanassche@acm.org>
Thu, 18 May 2023 19:31:59 +0000 (12:31 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 31 May 2023 15:05:34 +0000 (11:05 -0400)
Instead of running the request queue of each device associated with a host
every 3 ms (BLK_MQ_RESOURCE_DELAY) while host error handling is in
progress, run the request queue after error handling has finished.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230518193159.1166304-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c

index 25489fbd94c6c234bfe1f785af581b76a13ad37d..d1a0b15d45147d083b862c169c347446539f9f67 100644 (file)
@@ -122,11 +122,9 @@ static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd, unsigned long msecs)
                WARN_ON_ONCE(true);
        }
 
-       if (msecs) {
-               blk_mq_requeue_request(rq, false);
+       blk_mq_requeue_request(rq, false);
+       if (!scsi_host_in_recovery(cmd->device->host))
                blk_mq_delay_kick_requeue_list(rq->q, msecs);
-       } else
-               blk_mq_requeue_request(rq, true);
 }
 
 /**
@@ -165,7 +163,8 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy)
         */
        cmd->result = 0;
 
-       blk_mq_requeue_request(scsi_cmd_to_rq(cmd), true);
+       blk_mq_requeue_request(scsi_cmd_to_rq(cmd),
+                              !scsi_host_in_recovery(cmd->device->host));
 }
 
 /**
@@ -453,6 +452,7 @@ static void scsi_run_queue(struct request_queue *q)
        if (!list_empty(&sdev->host->starved_list))
                scsi_starved_list_run(sdev->host);
 
+       blk_mq_kick_requeue_list(q);
        blk_mq_run_hw_queues(q, false);
 }
 
@@ -503,6 +503,9 @@ static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd)
 
 static void scsi_run_queue_async(struct scsi_device *sdev)
 {
+       if (scsi_host_in_recovery(sdev->host))
+               return;
+
        if (scsi_target(sdev)->single_lun ||
            !list_empty(&sdev->host->starved_list)) {
                kblockd_schedule_work(&sdev->requeue_work);