scsi: sd: Do not override max_sectors_kb sysfs setting
authorMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Sep 2017 01:38:59 +0000 (21:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:51:25 +0000 (11:51 +0200)
commit12b182a35f459efdadeca230a2d365d938c5c510
tree8bc0d29316bb056a070b90682d949a8ded077189
parentaee20f321daf95f47183d4af8b0c3dcd0096fe25
scsi: sd: Do not override max_sectors_kb sysfs setting

commit 77082ca503bed061f7fbda7cfd7c93beda967a41 upstream.

A user may lower the max_sectors_kb setting in sysfs to accommodate
certain workloads. Previously we would always set the max I/O size to
either the block layer default or the optional preferred I/O size
reported by the device.

Keep the current heuristics for the initial setting of max_sectors_kb.
For subsequent invocations, only update the current queue limit if it
exceeds the capabilities of the hardware.

Reported-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd.c