Factor code common out so that it can be reused independently for the blk-mq
code path.

Split from a bigger patch by Nicholas Bellinger.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 drivers/scsi/scsi_lib.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3b3c3ab..e67950c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1690,16 +1690,10 @@ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL(scsi_calculate_bounce_limit);
 
-struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
-                                        request_fn_proc *request_fn)
+static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
 {
-       struct request_queue *q;
        struct device *dev = shost->dma_dev;
 
-       q = blk_init_queue(request_fn, NULL);
-       if (!q)
-               return NULL;
-
        /*
         * this limit is imposed by hardware restrictions
         */
@@ -1730,7 +1724,17 @@ struct request_queue *__scsi_alloc_queue(struct 
Scsi_Host *shost,
         * blk_queue_update_dma_alignment() later.
         */
        blk_queue_dma_alignment(q, 0x03);
+}
 
+struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
+                                        request_fn_proc *request_fn)
+{
+       struct request_queue *q;
+
+       q = blk_init_queue(request_fn, NULL);
+       if (!q)
+               return NULL;
+       __scsi_init_queue(shost, q);
        return q;
 }
 EXPORT_SYMBOL(__scsi_alloc_queue);
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to