TRIM/UNMAP/DISCARD via ATA Passthrough

From: Jason A. Donenfeld
Date: Mon Sep 12 2016 - 14:57:24 EST


Hi folks,

There's a huge quantity of USB enclosures flooding the market for
quite sometime that support UASP, which is very nice. This allows for
higher speeds by using the SCSI command set via the uas driver, and
offers various other advantages over the classic usb-storage driver.

These USB enclosures do not support SCSI UNMAP. However, they do
support ATA-passthrough, and `hdparm -I` shows that TRIM is supported.

I was wondering if it'd be possible to have the uas driver -- or
perhaps somewhere else in the stack -- fall back to using
ATA-passthrough-TRIM for UNMAP, so that discard can work properly.
AFAIK, the Windows drivers do exactly this.

If the answer is, "yes we want this! but we don't have the man power,"
please tell me where I can start looking, so that I can submit the
patch myself.

Thanks,
Jason