sd: Fix rw_max for devices that report an optimal xfer size
authorMartin K. Petersen <martin.petersen@oracle.com>
Fri, 13 May 2016 02:17:34 +0000 (22:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Oct 2016 07:01:33 +0000 (03:01 -0400)
commit9814eb75495bcd2fd2fc234bd474f0c395407c4c
tree136ae28f78c1cbb12ad17a859cfcc78ba8ef4778
parent43d03a59f1c00d6492a786c87d3a53336b6f375f
sd: Fix rw_max for devices that report an optimal xfer size

commit 6b7e9cde49691e04314342b7dce90c67ad567fcc upstream.

For historic reasons, io_opt is in bytes and max_sectors in block layer
sectors. This interface inconsistency is error prone and should be
fixed. But for 4.4--4.7 let's make the unit difference explicit via a
wrapper function.

Fixes: d0eb20a863ba ("sd: Optimal I/O size is in bytes, not sectors")
Reported-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Andrew Patterson <andrew.patterson@hpe.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd.c
drivers/scsi/sd.h