diff options
author | John Garry <john.garry@huawei.com> | 2022-07-14 19:15:26 +0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-07-19 06:05:47 +0200 |
commit | bb7d1283e6280acdfe0faf10e8b6ebd1f5970fed (patch) | |
tree | a88892c614aae0e977799e418242fdbb56e67843 /drivers/scsi/hosts.c | |
parent | 6d9870b7e5def2450e21316515b9efc0529204dd (diff) | |
download | lwn-bb7d1283e6280acdfe0faf10e8b6ebd1f5970fed.tar.gz lwn-bb7d1283e6280acdfe0faf10e8b6ebd1f5970fed.zip |
scsi: core: cap shost max_sectors according to DMA limits only once
The shost->max_sectors is repeatedly capped according to the host DMA
mapping limit for each sdev in __scsi_init_queue(). This is unnecessary, so
set only once when adding the host.
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/hosts.c')
-rw-r--r-- | drivers/scsi/hosts.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 8352f90d997d..d04bd2c7c9f1 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -236,6 +236,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, shost->dma_dev = dma_dev; + if (dma_dev->dma_mask) { + shost->max_sectors = min_t(unsigned int, shost->max_sectors, + dma_max_mapping_size(dma_dev) >> SECTOR_SHIFT); + } + error = scsi_mq_setup_tags(shost); if (error) goto fail; |