mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Use the correct size to set block max sectors
@ 2016-05-27  0:08 Long Li
  2016-05-27  0:40 ` Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Long Li @ 2016-05-27  0:08 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Long Li, KY Srinivasan, linux-scsi, linux-kernel

The block sector size should be in unit of 512 bytes, not in bytes.

Signed-off-by: Long Li <longli@microsoft.com>

---
 drivers/scsi/sd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 428c03e..4bce17e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	if (sdkp->opt_xfer_blocks &&
 	    sdkp->opt_xfer_blocks <= dev_max &&
 	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
-	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
-		rw_max = q->limits.io_opt =
+	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
+		q->limits.io_opt =
 			sdkp->opt_xfer_blocks * sdp->sector_size;
+		rw_max = (q->limits.io_opt >> 9);
+	}
 	else
 		rw_max = BLK_DEF_MAX_SECTORS;
 
-- 
1.8.5.6

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-03 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27  0:08 [PATCH] Use the correct size to set block max sectors Long Li
2016-05-27  0:40 ` Fam Zheng
2016-05-27  1:35 ` Joe Perches
2016-05-27  2:18 ` Bart Van Assche
2016-05-27  4:06   ` Long Li
2016-06-01  2:44     ` Martin K. Petersen
2016-06-03 22:42       ` Long Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®