summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-12-13 16:17:03 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2018-12-19 05:13:12 +0100
commit50c2e9107f176a82e14567b39c5d0f2a208cc82c (patch)
tree94cdec8e5724b7fb66f0781bcf6a4360653b097e /drivers/scsi/scsi_lib.c
parentscsi: flip the default on use_clustering (diff)
downloadlinux-50c2e9107f176a82e14567b39c5d0f2a208cc82c.tar.xz
linux-50c2e9107f176a82e14567b39c5d0f2a208cc82c.zip
scsi: introduce a max_segment_size host_template parameters
This allows the host driver to indicate the maximum supported segment size in a nice an easy way, so that the driver doesn't have to worry about DMA-layer imposed limitations. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f6900e0b3024..2d4fd6b4bd92 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2227,7 +2227,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
blk_queue_segment_boundary(q, shost->dma_boundary);
dma_set_seg_boundary(dev, shost->dma_boundary);
- blk_queue_max_segment_size(q, dma_get_max_seg_size(dev));
+ blk_queue_max_segment_size(q,
+ min(shost->max_segment_size, dma_get_max_seg_size(dev)));
if (shost->use_clustering == DISABLE_CLUSTERING)
q->limits.cluster = 0;