]> git.baikalelectronics.ru Git - kernel.git/commit
sd: Limit transfer length
authorMartin K. Petersen <martin.petersen@oracle.com>
Tue, 3 Jun 2014 22:45:51 +0000 (18:45 -0400)
committerChristoph Hellwig <hch@lst.de>
Thu, 17 Jul 2014 20:07:33 +0000 (22:07 +0200)
commitb7bb22bd5428aa1314ff469501d4c895990a8eb0
tree00131e8131aaeb1a94c61556dfb87ded905dd5e3
parentead805410f2bad3e818fb6f0e623e372c9e37858
sd: Limit transfer length

Until now the per-command transfer length has exclusively been gated by
the max_sectors parameter in the scsi_host template. Given that the size
of this parameter has been bumped to an unsigned int we have to be
careful not to exceed the target device's capabilities.

If the if the device specifies a Maximum Transfer Length in the Block
Limits VPD we'll use that value. Otherwise we'll use 0xffffffff for
devices that have use_16_for_rw set and 0xffff for the rest. We then
combine the chosen disk limit with max_sectors in the host template. The
smaller of the two will be used to set the max_hw_sectors queue limit.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/sd.c
drivers/scsi/sd.h