Problem adding SCSI quirks for a SSD, 4K sector and ZFS

Borja Marcos borjam at sarenet.es
Thu Jan 24 09:46:26 UTC 2013


Hello,

Crossposting to FreeBSD-fs, as I am wondering if I have had a problem with ZFS and sector size detection as well.

I am doing tests with an OCZ Vertex 4 connected to a SAS backplane.

< OCZ-VERTEX4 1.5>                 at scbus6 target 22 lun 0 (pass19,da15)

(The blank before "OCZ" really appears there)

pass19: < OCZ-VERTEX4 1.5> Fixed Direct Access SCSI-5 device 
pass19: Serial Number OCZ-1SVG6KZ2YRMSS8E1
pass19: 3.300MB/s transfers

I am bypassing an "aac" RAID card so that the disks are directly attached to the da driver, instead of relying on the so-called JBOD feature.

I have had a weird problem, with the disk being unresponsive to the REQUEST CAPACITY(16) command. Weird, seems it timeouts.

So, just to complete the tests, I have added a quirk to scsi_da.c. Anyway, I also need the disk to be recognized as a 4K sector drive.

I created a new quirk, called it DA_Q_NO_RC16, and added an  entry to the quirk table, so that these drives are recognized as 4K drives  and the driver doesn't try to send a RC(16) command.

diff scsi_da.c.orig scsi_da.c
93c93,94
< 	DA_Q_4K			= 0x08
---
> 	DA_Q_4K			= 0x08,
> 	DA_Q_NO_RC16		= 0x10
811a813,817
> 		/* OCZ Vertex 4 firmware 1.5 */
> 		{ T_DIRECT, SIP_MEDIA_FIXED, "", "OCZ-VERTEX4", "*" },
> 		/*quirks*/DA_Q_NO_RC16 | DA_Q_4K
> 	},
> 	{
1635,1636c1641,1646
< 	/* Predict whether device may support READ CAPACITY(16). */
< 	if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) {
---
> 	/* 
> 	 * Predict whether device may support READ CAPACITY(16).
> 	 * BUT Some disks don't support RC(16) even though they should.
> 	 */
> 	if ((SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) 
> 		&& !(softc->quirks & DA_Q_NO_RC16) ) {



I think it's working. I haven't seen any more RC(16) errors, and the disk is working fine. Anyway I am not sure I've done it right. After adding the 4K quirk and rebooting, GEOM_PART complained that the partitions weren't aligned to 4K

/var/log/messages.0:Jan 23 16:01:30  kernel: GEOM_PART: partition 1 is not aligned on 4096 bytes
/var/log/messages.0:Jan 23 16:01:30  kernel: GEOM_PART: partition 2 is not aligned on 4096 bytes

So it seems it works. However, when using the disk for ZFS, it still detects a 512 byte sector size, which is odd. 

Jan 23 16:01:30 rasputin kernel: GEOM: new disk da15
Jan 23 16:01:30 rasputin kernel: da15 at aacp0 bus 0 scbus6 target 22 lun 0
Jan 23 16:01:30 rasputin kernel: da15: < OCZ-VERTEX4 1.5> Fixed Direct Access SCSI-5 device 
Jan 23 16:01:30 rasputin kernel: da15: Serial Number OCZ-1SVG6KZ2YRMSS8E1
Jan 23 16:01:30 rasputin kernel: da15: 3.300MB/s transfers
Jan 23 16:01:30 rasputin kernel: da15: 488386MB (1000215216 512 byte sectors: 255H 63S/T 62260C)


diskinfo is returning a sector size of 512 bytes, and a stripesize of 4096. Is this correct? ZFS is still detecting it as a 512 byte sector disk.

/dev/da15
	512         	# sectorsize
	512110190592	# mediasize in bytes (477G)
	1000215216  	# mediasize in sectors
	4096        	# stripesize
	0           	# stripeoffset
	62260       	# Cylinders according to firmware.
	255         	# Heads according to firmware.
	63          	# Sectors according to firmware.
	OCZ-1SVG6KZ2YRMSS8E1	# Disk ident.



So, to summarize:

If the quirk was working, should diskinfo return a sector size of 512 bytes, or is it correct  to show a "stripesize" of 4096?

Do we have a bug either on ZFS  or the disk drivers? The same experiment on another system (both are 9.1-RELEASE) and a similar drive attached to a SATA controller, also adding a 4K sector quirk for it, defines a stripe size instead of a sector size.




Thanks,





Borja.



More information about the freebsd-scsi mailing list