Skip to contentSkip to conversation

scsi optimal_io_size changed from 0 on kernel 6.6, to 16773120(32760*512, 4095*4096) on kernel 6.12/6.16

DISCUSSION Wang Yugui 2 participants 4 messages Jun 24, 2025 – Jun 25, 2025

Subsystems (2)
lore
Share & tools
lore

Wang Yugui

author
#0 lore raw

Hi,

scsi optimal_io_size changed
from 0 on kernel 6.6,
to 16773120(32760*512, 4095*4096) on kernel 6.12/6.16

I tested in on same device and same os dist, but different kernel version. both ssd/sas and ssd/sata connected to same hba(mpi3sas driver).

Is there some feature that changed the default value?

Best Regards
Wang Yugui ([email protected])
2025/06/24

author
#1 lore raw

Hi,

Quoted 8 lines

scsi optimal_io_size changed
from 0 on kernel 6.6,
to 16773120(32760*512, 4095*4096) on kernel 6.12/6.16

I tested in on same device and same os dist, but different kernel version. both ssd/sas and ssd/sata connected to same hba(mpi3sas driver).

Is there some feature that changed the default value?

we walked around this problem with a local dirty fix.

drivers/scsi/scsi_transport_sas.c +3 -0
index 351b028ef893..638dbafd695d 100644
@@ -240,6 +240,9 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev,
 	if (dma_dev->dma_mask) {
 		shost->opt_sectors = min_t(unsigned int, shost->max_sectors,
 				dma_opt_mapping_size(dma_dev) >> SECTOR_SHIFT);
+		/* /sys/block/sda/queue/optimal_io_size 16773120(32760*512, 4095*4096) @T7610 @kernel 6.12+ */
+		shost->opt_sectors = min_t(unsigned int, shost->opt_sectors,
+				SZ_1M >> SECTOR_SHIFT);
 	}
 
 	return 0;

Best Regards
Wang Yugui ([email protected])
2025/06/25

#2 lore raw
In reply to Wang Yugui

Wang,

Quoted 2 lines

scsi optimal_io_size changed from 0 on kernel 6.6, to 16773120(32760*512, 4095*4096) on kernel 6.12/6.16

Peculiar value. Please share the output of:

# sg_readcap -l /dev/sdN

and

# sg_vpd -p bl /dev/sdN

Thanks!

Signature · 1 line
Martin K. Petersen
author
#3 lore raw

Hi,

Quoted 7 lines

Wang,

Quoted 2 lines

scsi optimal_io_size changed from 0 on kernel 6.6, to 16773120(32760*512, 4095*4096) on kernel 6.12/6.16

Peculiar value. Please share the output of:

It seems the valule of

	'shost->opt_sectors'
	'dma_opt_mapping_size(dma_dev) >> SECTOR_SHIFT'

that means the optimal_io_size of scsi host(hba).

Quoted 7 lines
# sg_readcap -l /dev/sdN

and

# sg_vpd -p bl /dev/sdN
# lsscsi
[0:0:0:0]    disk    HITACHI  HUSMH842 CLAR100 C292  /dev/sda
[0:0:1:0]    disk    ATA      INTEL SSDSC2BB48 0121  /dev/sdb
[5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD11  /dev/sr0
# sg_readcap -l /dev/sda
Read Capacity results:
   Protection: prot_en=1, p_type=1, p_i_exponent=0 [type 2 protection]
   Logical block provisioning: lbpme=1, lbprz=1
   Last LBA=195371567 (0xba5222f), Number of logical blocks=195371568
   Logical block length=512 bytes
   Logical blocks per physical block exponent=3 [so physical block length=4096 bytes]
   Lowest aligned LBA=0
Hence:
   Device size: 100030242816 bytes, 95396.3 MiB, 100.03 GB
# sg_readcap -l /dev/sda
Read Capacity results:
   Protection: prot_en=1, p_type=1, p_i_exponent=0 [type 2 protection]
   Logical block provisioning: lbpme=1, lbprz=1
   Last LBA=195371567 (0xba5222f), Number of logical blocks=195371568
   Logical block length=512 bytes
   Logical blocks per physical block exponent=3 [so physical block length=4096 bytes]
   Lowest aligned LBA=0
Hence:
   Device size: 100030242816 bytes, 95396.3 MiB, 100.03 GB
#

Best Regards
Wang Yugui ([email protected])
2025/06/25