[PATCH] scsi: sd: Add a comment about limiting max_sectors to shost optimal limit

John Garry posted 1 patch 3 years, 9 months ago
[PATCH] scsi: sd: Add a comment about limiting max_sectors to shost optimal limit
Posted by John Garry 3 years, 9 months ago
Add a comment about limiting the default the SCSI disk request_queue
max_sectors initial value to that of the SCSI host optimal sectors limit.

Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3eaee1f7aaca..ed9f43f9512e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3296,6 +3296,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
 				      (sector_t)BLK_DEF_MAX_SECTORS);
 	}
 
+	/*
+	 * Limit default to SCSI host optimal sector limit if set. There may be
+	 * an impact on performance for when the size of a request exceeds this
+	 * host limit.
+	 */
 	rw_max = min_not_zero(rw_max, sdp->host->opt_sectors);
 
 	/* Do not exceed controller limit */
-- 
2.35.3
Re: [PATCH] scsi: sd: Add a comment about limiting max_sectors to shost optimal limit
Posted by Christoph Hellwig 3 years, 8 months ago
Thanks, applied.
Re: [PATCH] scsi: sd: Add a comment about limiting max_sectors to shost optimal limit
Posted by Martin K. Petersen 3 years, 9 months ago
John,

> Add a comment about limiting the default the SCSI disk request_queue
> max_sectors initial value to that of the SCSI host optimal sectors limit.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH] scsi: sd: Add a comment about limiting max_sectors to shost optimal limit
Posted by Damien Le Moal 3 years, 9 months ago
On 7/19/22 18:51, John Garry wrote:
> Add a comment about limiting the default the SCSI disk request_queue
> max_sectors initial value to that of the SCSI host optimal sectors limit.
> 
> Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: John Garry <john.garry@huawei.com>
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3eaee1f7aaca..ed9f43f9512e 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -3296,6 +3296,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  				      (sector_t)BLK_DEF_MAX_SECTORS);
>  	}
>  
> +	/*
> +	 * Limit default to SCSI host optimal sector limit if set. There may be
> +	 * an impact on performance for when the size of a request exceeds this
> +	 * host limit.
> +	 */
>  	rw_max = min_not_zero(rw_max, sdp->host->opt_sectors);
>  
>  	/* Do not exceed controller limit */

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research