From owner-freebsd-scsi@FreeBSD.ORG Thu Jan 24 09:46:26 2013 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D5DEC5E9; Thu, 24 Jan 2013 09:46:26 +0000 (UTC) (envelope-from borjam@sarenet.es) Received: from proxypop04.sare.net (proxypop04.sare.net [194.30.0.65]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0EA83F; Thu, 24 Jan 2013 09:46:26 +0000 (UTC) Received: from [172.16.2.2] (izaro.sarenet.es [192.148.167.11]) by proxypop04.sare.net (Postfix) with ESMTPSA id 0714F9DEB8D; Thu, 24 Jan 2013 10:46:13 +0100 (CET) From: Borja Marcos Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Problem adding SCSI quirks for a SSD, 4K sector and ZFS Date: Thu, 24 Jan 2013 10:46:23 +0100 Message-Id: <492280E6-E3EE-4540-92CE-C535C8943CCF@sarenet.es> To: freebsd-scsi@freebsd.org Mime-Version: 1.0 (Apple Message framework v1085) X-Mailer: Apple Mail (2.1085) Cc: FreeBSD Filesystems X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 09:46:26 -0000 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=20 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 =3D 0x08 --- > DA_Q_4K =3D 0x08, > DA_Q_NO_RC16 =3D 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) >=3D SCSI_REV_SPC3) { --- > /*=20 > * 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) >=3D SCSI_REV_SPC3)=20 > && !(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.=20 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=20 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.