diff mbox

bogus optimal IO sizes for ASMedia ASM105x

Message ID yq1r2lkehnz.fsf@oracle.com (mailing list archive)
State Superseded
Headers show

Commit Message

Martin K. Petersen June 6, 2018, 3:08 a.m. UTC
Christoph,

> Apparently the optimal IO sizes reported by the ASMedia ASM105x is
> bogus.
>
> Not sure whether the kernel provides means to work around quirks at
> this level, but in case it does it would be nice if some reasonable
> value could be used to override the opt io of 33553920.

We have had devices with bogus values before. The problem in this case
is that 32M is a large, but not entirely unreasonable, stripe I/O width
for a storage array.

Does this fix it for you?

Comments

Christoph Anton Mitterer June 7, 2018, midnight UTC | #1
Hey Martin.

On Tue, 2018-06-05 at 23:08 -0400, Martin K. Petersen wrote:
> We have had devices with bogus values before. The problem in this
> case
> is that 32M is a large, but not entirely unreasonable, stripe I/O
> width
> for a storage array.
Well I guess at least if it's not a multiple of the block size, one can
safely assume it bogus, can't one?


> Does this fix it for you?
I applied it to 4.16.12 from Debian and created new packages with it
(don't think I made any error there)... but there was no change, and
lsblk still showed the same opt io sizes.

:-(


Cheers,
Chris.
diff mbox

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 9421d9877730..4e2fdfa870c2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3126,12 +3126,13 @@  static int sd_revalidate_disk(struct gendisk *disk)
 
 	/*
 	 * Determine the device's preferred I/O size for reads and writes
-	 * unless the reported value is unreasonably small, large, or
-	 * garbage.
+	 * unless the reported value is unreasonably small, large, not a
+	 * multiple of the physical block size, or simply garbage.
 	 */
 	if (sdkp->opt_xfer_blocks &&
 	    sdkp->opt_xfer_blocks <= dev_max &&
 	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
+	    sdkp->opt_xfer_blocks & sdkp->physical_block_size - 1 != 0 &&
 	    logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) {
 		q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
 		rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);