zfs/cmd
Richard Yao bff32e0972 Implement database to workaround misreported physical sector sizes
This implements vdev_bdev_database_check(). It alters the detected
sector size of any device listed in a database of drives known to lie
about their physical sector sizes.

This is based on "6931570 Add flash devices' VID/PID to disk table to
advertising 4K physical sector size" from Open Solaris and on
sg_simple4.c from sg3_utils. About two dozen lines are taken from
sg_simple4.c, which is GPLv2 licensed. However, sg_simple4.c is
analogous to a Hello World program and is safe for us to use. We
requested that Douglas Gilbert, the author of sg_simple4.c, confirm that
this is the case. A cutdown version of his response is as follows:

```
I would consider a SCSI INQUIRY example using the Linux sg
driver interface (also written by me) as the equivalent of an
"hello world" program in C.
```

The database was created with the help of the freenode and ZFSOnLinux
communities.

Some notes:

1. The following drives both were confirmed to lie via reports in IRC
and they contain capacity information in their identifiers:

INTEL SSDSA2M080
INTEL SSDSA2M160
M4-CT256M4SSD2
WDC WD15EARS-00S
WDC WD15EARS-00Z
WDC WD20EARS-00M

The identifiers for different capacity models were extrapolated and
added under the assumption that those models also lie. Google was used
to verify that the extrapolated drive identifiers existed prior to their
inclusion.

2. The OCZ-VERTEX2 3.5 identifer applies to two drives that differ
solely in page size (and slightly in capacity). One uses 4096-byte pages
and the other uses 8192-byte pages. Both are set to use 8192-byte pages.
We could detect the page size by checking the capacity, but that would
unnecessarily complicate the code.

3. It is possible for updated drive firmware to correctly report the
sector size. There were reports of a few advanced format drives doing
that. One report stated that the vendor changed the identification
string while another was unclear on this. Both reports involved WDC
models.

4. Google was used to determine the size of pages in the listed flash
devices. Reports of 8192-byte pages took precedence over reports of
4096-byte pages.

5. Devices behind USB adapters can have their identification strings
altered. Identification strings obtained across USB adapters are
omitted and no attempt is made to correct for alterations made by USB
adapters when doing comparisons against the database. Two entries in the
Open Solaris database that appear to have been altered by a USB
adapter were omitted.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1652
2013-08-22 11:24:06 -07:00
..
arcstat Modified arcstat.py to run on linux 2013-06-18 15:43:15 -07:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Fix parse_dataset error handling 2013-07-03 09:20:52 -07:00
vdev_id vdev_id: improve keyword parsing flexibility 2013-01-25 13:44:32 -08:00
zdb zdb: enhancement - Display SA xattrs. 2013-07-09 13:52:28 -07:00
zfs Don't specifically open /etc/mtab - it is done in libzfs_init() 2013-08-15 10:19:38 -07:00
zhack Illumos #2619 and #2747 2013-01-08 10:35:35 -08:00
zinject Use setmntent() OR fopen() 2013-08-15 10:09:09 -07:00
zpios Refresh links to web site 2013-03-06 15:46:41 -08:00
zpool Implement database to workaround misreported physical sector sizes 2013-08-22 11:24:06 -07:00
zstreamdump Add zstreamdump .gitignore 2012-09-06 14:23:11 -07:00
ztest Use MAXPATHLEN instead of sizeof in snprintf 2013-07-02 10:39:24 -07:00
zvol_id Remove autotools products 2012-08-27 11:47:44 -07:00
Makefile.am Modified arcstat.py to run on linux 2013-06-18 15:43:15 -07:00