diff options
author | John Garry <john.garry@huawei.com> | 2022-07-14 13:15:29 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-07-19 11:11:49 +0200 |
commit | 0568e6122574dcc1aded2979cd0245038efe22b6 (patch) | |
tree | 22e9e584d86563236ef6f0a3efa999fa6834e7c4 | |
parent | scsi: scsi_transport_sas: cap shost opt_sectors according to DMA optimal limit (diff) | |
download | linux-0568e6122574dcc1aded2979cd0245038efe22b6.tar.xz linux-0568e6122574dcc1aded2979cd0245038efe22b6.zip |
ata: libata-scsi: cap ata_device->max_sectors according to shost->max_sectors
ATA devices (struct ata_device) have a max_sectors field which is
configured internally in libata. This is then used to (re)configure the
associated sdev request queue max_sectors value from how it is earlier set
in __scsi_init_queue(). In __scsi_init_queue() the max_sectors value is set
according to shost limits, which includes host DMA mapping limits.
Cap the ata_device max_sectors according to shost->max_sectors to respect
this shost limit.
Signed-off-by: John Garry <john.garry@huawei.com>
Acked-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>
-rw-r--r-- | drivers/ata/libata-scsi.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 86dbb1cdfabd..24a43d540d9f 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1060,6 +1060,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) dev->flags |= ATA_DFLAG_NO_UNLOAD; /* configure max sectors */ + dev->max_sectors = min(dev->max_sectors, sdev->host->max_sectors); blk_queue_max_hw_sectors(q, dev->max_sectors); if (dev->class == ATA_DEV_ATAPI) { |