Re: [PATCH v8 1/1] scsi: sas: skip opt_sectors when DMA reports no real optimization hint

From: Christoph Hellwig

Date: Mon May 25 2026 - 02:02:41 EST


On Tue, May 19, 2026 at 04:52:33PM +0300, Ionut Nechita (Wind River) wrote:
> +static void sas_dma_setup_opt_sectors(struct Scsi_Host *shost)
> +{
> + struct device *dma_dev = shost->dma_dev;
> + size_t opt, max;
> + unsigned int opt_sectors;
> +
> + opt = dma_opt_mapping_size(dma_dev);
> + max = dma_max_mapping_size(dma_dev);

I'm almost feeling bad for suggesting more changes, but this would read
much cleaner by doing:

struct device *dma_dev = shost->dma_dev;
size_t opt = dma_opt_mapping_size(dma_dev);
size_t max = dma_max_mapping_size(dma_dev);
unsigned int opt_sectors;

but otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>