From: Bart Van Assche Date: Fri, 2 Jun 2017 21:21:56 +0000 (-0700) Subject: scsi: Introduce scsi_start_queue() X-Git-Tag: v4.1.12-124.31.3~1130 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cb6c5020d3255b1d3d9e8ef70b3fb91fb4f2076d;p=users%2Fjedix%2Flinux-maple.git scsi: Introduce scsi_start_queue() This patch does not change any functionality. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Cc: Israel Rukshin Cc: Max Gurtovoy Cc: Benjamin Block Signed-off-by: Martin K. Petersen Orabug: 27546768 (cherry picked from commit 66483a4a9f34427e3d6ec87d8e583f5d2a7cbb76) Signed-off-by: Kyle Fortin Reviewed-by: Martin K. Petersen --- diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2ee399b9335d..ab4d4f022d81 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2971,6 +2971,20 @@ scsi_internal_device_block(struct scsi_device *sdev) } EXPORT_SYMBOL_GPL(scsi_internal_device_block); +void scsi_start_queue(struct scsi_device *sdev) +{ + struct request_queue *q = sdev->request_queue; + unsigned long flags; + + if (q->mq_ops) { + blk_mq_start_stopped_hw_queues(q, false); + } else { + spin_lock_irqsave(q->queue_lock, flags); + blk_start_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + } +} + /** * scsi_internal_device_unblock - resume a device after a block request * @sdev: device to resume @@ -2991,9 +3005,6 @@ int scsi_internal_device_unblock(struct scsi_device *sdev, enum scsi_device_state new_state) { - struct request_queue *q = sdev->request_queue; - unsigned long flags; - /* * Try to transition the scsi device to SDEV_RUNNING or one of the * offlined states and goose the device queue if successful. @@ -3011,13 +3022,7 @@ scsi_internal_device_unblock(struct scsi_device *sdev, sdev->sdev_state != SDEV_OFFLINE) return -EINVAL; - if (q->mq_ops) { - blk_mq_start_stopped_hw_queues(q, false); - } else { - spin_lock_irqsave(q->queue_lock, flags); - blk_start_queue(q); - spin_unlock_irqrestore(q->queue_lock, flags); - } + scsi_start_queue(sdev); return 0; } diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index e3902fc66278..af6ff3aad824 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -87,6 +87,7 @@ extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); extern void scsi_run_host_queues(struct Scsi_Host *shost); extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); extern struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev); +extern void scsi_start_queue(struct scsi_device *sdev); extern int scsi_mq_setup_tags(struct Scsi_Host *shost); extern void scsi_mq_destroy_tags(struct Scsi_Host *shost); extern int scsi_init_queue(void);