diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-17 14:19:54 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-07-16 23:01:49 -0400 |
commit | bdd17bdef7d8da4d8eee254abb4c92d8a566bdc1 (patch) | |
tree | 0a93328605a47da7ad488683e54c5d7b2db83ced /drivers/scsi | |
parent | 7ad388d8e4c703980b7018b938cdeec58832d78d (diff) | |
download | linux-bdd17bdef7d8da4d8eee254abb4c92d8a566bdc1.tar.bz2 |
scsi: core: take the DMA max mapping size into account
We need to limit the device's max_sectors to what the DMA mapping
implementation can support. If not, we risk running out of swiotlb
buffers easily.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 404e5e28ef62..699623f81dde 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1784,6 +1784,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize); } + shost->max_sectors = min_t(unsigned int, shost->max_sectors, + dma_max_mapping_size(dev) << SECTOR_SHIFT); blk_queue_max_hw_sectors(q, shost->max_sectors); if (shost->unchecked_isa_dma) blk_queue_bounce_limit(q, BLK_BOUNCE_ISA); |