Re: [PATCH 3/4] scsi: core: Cap shost max_sectors according to DMA optimum mapping limits

Damien Le Moal
2022-05-23T07:33:53Z

On 2022/05/23 15:53, John Garry wrote:
> On 21/05/2022 00:30, Damien Le Moal wrote:
>>> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
>>> index f69b77cbf538..a3ae6345473b 100644
>>> --- a/drivers/scsi/hosts.c
>>> +++ b/drivers/scsi/hosts.c
>>> @@ -225,6 +225,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
>>> shost->cmd_per_lun = min_t(int, shost->cmd_per_lun,
>>> shost->can_queue);
>>>
>
> Hi Damien,
>
>>> + if (dma_dev->dma_mask) {
>>> + shost->max_sectors = min_t(unsigned int, shost->max_sectors,
>>> + dma_opt_mapping_size(dma_dev) >> SECTOR_SHIFT);
>>> + }
>> Nit: you could drop the curly brackets here.
>
> Some people prefer this style - multi-line statements have curly
> brackets, while single-line statements conform to the official coding
> style (and don't use brackets).

OK.

>
> I'll just stick with what we have unless there is a consensus to change.
>
> Thanks,
> John
>
>>
>>> +
>>> error = scsi_init_sense_cache(shost);
>>> if (error)
>>> goto fail;
>

--
Damien Le Moal
Western Digital Research