SCSI discovery update

Martin K. Petersen
2022-03-02T05:36:33Z

This series addresses several issues in the SCSI device discovery
code:

- Fetch the VPD header before getting the full VPD page. This removes
the guesswork from sizing the VPD buffer and fixes problems with
RAID controllers that wedge when we try to fetch the IDENTIFY
DEVICE information trailing the ATA Information VPD page.

- Cache the VPD pages we need instead of fetching them every
revalidate iteration.

- Avoid truncating the INQUIRY length for modern devices. This allows
us to query the version descriptors reported by most contemporary
drives. These version descriptors are used as an extra heuristic
for querying protocol features.

- Additional sanity checking for the reported minimum and optimal I/O
sizes.

- Fix reported discard failures by making the configuration a
two-stage process. Completing full VPD/RSOC discovery before we
configure discard prevents a small window of error where the wrong
command and/or wrong limit would briefly be applied.

- Make the zeroing configuration a two-stage process as well.

- Implement support for the NDOB flag for both discards and
zeroing. The "No Data Out Buffer" flag removes the need for a
zeroed payload to be included with a WRITE SAME(16) command.

- Remove the superfluous revalidate operation historically required
by the integrity profile registration. This further reduces the
commands we send during device discovery.

- Add additional heuristics for enabling discards on modern devices.
Specifically, if a device reports that it supports logical block
provisioning, attempt to query the LBP VPD page.

- Also query the device VPD pages if a device reports conformance to
a recent version of the SCSI Block Commands specification.

Thanks to several bug reporters and volunteers this series has been
extensively tested with a much wider variety of USB/UAS devices than I
have access to.

--
Martin K. Petersen Oracle Linux Engineering