We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ed94724 + 9c1d9c2 commit f9ec0d5Copy full SHA for f9ec0d5
1 file changed
drivers/scsi/sd.c
@@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)
2885
2886
/*
2887
* Use the device's preferred I/O size for reads and writes
2888
- * unless the reported value is unreasonably large (or garbage).
+ * unless the reported value is unreasonably small, large, or
2889
+ * garbage.
2890
*/
- if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
2891
- sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
+ if (sdkp->opt_xfer_blocks &&
2892
+ sdkp->opt_xfer_blocks <= dev_max &&
2893
+ sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
2894
+ sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
2895
rw_max = q->limits.io_opt =
2896
logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
2897
else
0 commit comments