diff mbox

[1/1] block: Add blk_max_rw_sectors limit

Message ID yq1616nff0p.fsf@sermon.lab.mkp.net (mailing list archive)
State New, archived
Headers show

Commit Message

Martin K. Petersen June 16, 2015, 10:46 p.m. UTC
Brian,

I only have minor nits wrt. your patch since you did what I asked.
However, now that I'm less jet lagged and blurry eyed I wonder if
the tweak below wouldn't suffice?


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>
Cc: stable@vger.kernel.org # 3.17+

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig June 17, 2015, 10:33 a.m. UTC | #1
On Tue, Jun 16, 2015 at 06:46:14PM -0400, Martin K. Petersen wrote:
> 
> Brian,
> 
> I only have minor nits wrt. your patch since you did what I asked.
> However, now that I'm less jet lagged and blurry eyed I wonder if
> the tweak below wouldn't suffice?

This would be my preferred version as well.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian King June 17, 2015, 1:26 p.m. UTC | #2
On 06/16/2015 05:46 PM, Martin K. Petersen wrote:
> 
> Brian,
> 
> I only have minor nits wrt. your patch since you did what I asked.
> However, now that I'm less jet lagged and blurry eyed I wonder if
> the tweak below wouldn't suffice?

Works for me. Thanks!

Tested-by: Brian King <brking@linux.vnet.ibm.com>

-Brian
diff mbox

Patch

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);
  * Description:
  *    Enables a low level driver to set a hard upper limit,
  *    max_hw_sectors, on the size of requests.  max_hw_sectors is set by
- *    the device driver based upon the combined capabilities of I/O
- *    controller and storage device.
+ *    the device driver based upon the capabilities of the I/O
+ *    controller.
  *
  *    max_sectors is a soft limit imposed by the block layer for
  *    filesystem type requests.  This value can be overridden on a
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 79beebf53302..cfc0de75d763 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2779,9 +2779,9 @@  static int sd_revalidate_disk(struct gendisk *disk)
 	max_xfer = sdkp->max_xfer_blocks;
 	max_xfer <<= ilog2(sdp->sector_size) - 9;
 
-	max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
-				max_xfer);
-	blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
+	sdkp->disk->queue->limits.max_sectors =
+		min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer);
+
 	set_capacity(disk, sdkp->capacity);
 	sd_config_write_same(sdkp);
 	kfree(buffer);