diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2015-06-23 12:13:59 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-08-12 14:54:37 -0400 |
commit | 4f258a46346c03fa0bbb6199ffaf4e1f9f599660 (patch) | |
tree | 87f6203edaaa3e9156c5f1710427a1915195e98e | |
parent | 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 (diff) |
sd: Fix maximum I/O size for BLOCK_PC requests
Commit bcdb247c6b6a ("sd: Limit transfer length") clamped the maximum
size of an I/O request to the MAXIMUM TRANSFER LENGTH field in the BLOCK
LIMITS VPD. This had the unfortunate effect of also limiting the maximum
size of non-filesystem requests sent to the device through sg/bsg.
Avoid using blk_queue_max_hw_sectors() and set the max_sectors queue
limit directly.
Also update the comment in blk_limits_max_hw_sectors() to clarify that
max_hw_sectors defines the limit for the I/O controller only.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reported-by: Brian King <brking@linux.vnet.ibm.com>
Tested-by: Brian King <brking@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # 3.17+
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | block/blk-settings.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 12600bfffca9..e0057d035200 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); | |||
241 | * Description: | 241 | * Description: |
242 | * Enables a low level driver to set a hard upper limit, | 242 | * Enables a low level driver to set a hard upper limit, |
243 | * max_hw_sectors, on the size of requests. max_hw_sectors is set by | 243 | * max_hw_sectors, on the size of requests. max_hw_sectors is set by |
244 | * the device driver based upon the combined capabilities of I/O | 244 | * the device driver based upon the capabilities of the I/O |
245 | * controller and storage device. | 245 | * controller. |
246 | * | 246 | * |
247 | * max_sectors is a soft limit imposed by the block layer for | 247 | * max_sectors is a soft limit imposed by the block layer for |
248 | * filesystem type requests. This value can be overridden on a | 248 | * filesystem type requests. This value can be overridden on a |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3b2fcb4fada0..a20da8c25b4f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
2770 | max_xfer = sdkp->max_xfer_blocks; | 2770 | max_xfer = sdkp->max_xfer_blocks; |
2771 | max_xfer <<= ilog2(sdp->sector_size) - 9; | 2771 | max_xfer <<= ilog2(sdp->sector_size) - 9; |
2772 | 2772 | ||
2773 | max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), | 2773 | sdkp->disk->queue->limits.max_sectors = |
2774 | max_xfer); | 2774 | min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer); |
2775 | blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer); | 2775 | |
2776 | set_capacity(disk, sdkp->capacity); | 2776 | set_capacity(disk, sdkp->capacity); |
2777 | sd_config_write_same(sdkp); | 2777 | sd_config_write_same(sdkp); |
2778 | kfree(buffer); | 2778 | kfree(buffer); |