This includes support for Host Managed, Host Aware and Drive Managed SMR
drives that are either SCSI (ZBC) or ATA (ZAC) attached via a SAS
controller. This also includes support for Host Aware SATA drives that are
attached via a SATA controller.
The big drive vendors are moving to SMR for at least some of their drives.
The primary challenge with SMR is that it requires writing a relatively
large zone sequentially starting at the beginning of the zone. The usual
zone size is 256MB. It is conceptually almost like having a 256MB sector
size.
We (Spectra Logic) are working on ZFS changes that will use this CAM and
GEOM infrastructure to make ZFS play well with SMR drives. Those changes
aren't yet done.
These patches include:
o A new 'camcontrol zone' command that allows displaying and managing
drive zones via SCSI/ATA passthrough.
o A new zonectl(8) utility that uses the new DIOCZONECMD ioctl to display
and manage zones via the da(4) (and later ada(4)) driver.
o Changes to diskinfo -v to display the zone mode of a drive.
o A new disk zone API, sys/sys/disk_zone.h.
o A new bio type, BIO_ZONE, and modifications to GEOM to support it. This
new bio will allow filesystems to query zone support in a drive and
manage zoned drives.
o Extensive modifications to the da(4) driver to handle probing SCSI and
SATA behind SAS SMR drives.
o Modifications to the ada(4) driver to handle probing of SATA SMR drives.
o ATA passthrough improvements, including support for the new 32-byte SCSI
ATA PASS-THROUGH(32) command that supports the auxiliary register. This
hasn't been tested due to lack of a SAT layer that implements it. It
isn't used in the da(4) driver, because if a SAT layer supports the 32
byte passthrough command, it will likely also support ZBC -> ZAC
translation.
o Added a new camcontrol epc subcommand, that allows getting/setting
Extended Power Conditions timers for ATA drives that support it.
If you look through the code, you'll notice that the disk_zone.h API is
separate from the SCSI and ATA APIs. The intent is to allow filesystems
and other consumers of the API to just talk to the disk zone API without
dealing with the SCSI and ATA specifics. Another reason behind all of this
is that even though the SCSI ZBC and ATA ZAC specs were developed in
concert, and are intended to be functionally identical, they are still SCSI
and ATA. As usual, SCSI is big endian and ATA is little endian. So to
present a common API to the filesystem, we give all of the zone data back
in native byte order, regardless of the underlying device protocol.
Another thing to note is the extensive use of ATA passthrough in the da(4)
driver. This is necessary because although the SCSI SAT (SCSI to ATA
Translation) specification has been updated to include SCSI zone commands
(ZBC) to ATA zone commands (ZAC), LSI/Avago/Broadcom has not yet released
SAS controller firmware that implements it. That said, though, the da(4)
driver is setup to prefer using the SCSI command set because that will
almost certainly be more efficient than using ATA passthrough. (ATA
passthrough commands are typically single stepped by necessity, although
that could theoretically change for NCQ commands.)
I have only tested the code so far with Seagate SATA Drive Managed and Host
Aware drives. I would appreciate testing with any drives. (And testing to
make sure that the patches don't cause problems with existing hardware.)
Right now, all you can really do is manage the zones manually using
camcontrol(8) or zonectl(8). Automatic management will come with the ZFS
changes. (Or changes to other filesysems if people want to do it.)
If you have a SATA Host Aware drive, in theory camcontrol(8) should allow
you to manage the drive if you have it attached to a SATA controller.
Test Plan:
Get a zone list with camcontrol:
camcontrol zone da0 -c rz -v
Get a zone list with zonectl:
zonectl -d /dev/da0 -c rz
Look at the drive zone status:
diskinfo -v /dev/da0
sysctl kern.cam.da.0
Look at EPC power modes:
camcontrol epc da0 -c list
Set the drive to spin down after an hour of idle time:
camcontrol epc da0 -c timer -T 3600 -p Standby_z -e -s
Tell the drive to go to the Standby_z power state:
camcontrol epc da4 -c goto -p Standby_z
Check the current drive state without causing it to spin up:
camcontrol epc da0 -c status -P