Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks

From: Theodore Ts'o
Date: Thu Mar 03 2016 - 12:02:55 EST


On Wed, Mar 02, 2016 at 03:49:53PM -0800, Linus Torvalds wrote:
> > No. This is not about enabling use of "that idiotic discard behavior", for
> > that there's BLKDISCARD. This ioctl does NOT use the handwavy old TRIM
> > advisory request thing that could return "fuzzy wuzzy" without violating the
> > specs.
>
> So you agree that we could just make BLKZEROOUT always use trim?

There is a massive bug in the SATA specs about trim, which is that it
is considered advisory. So the storage device can throw it away
whenever it feels like it. (In practice, when it's too busy doing
other things).

The thing is, this fuzzy wuzzy definition of trim in the SATA specs is
more and more a SATA-specific bug. The eMMC 5.1 spec has a reliable
trim, and SCSI has WRITE SAME. So it's just SATA which has this crazy
definition of trim.

(In practice there is no real difference between trim and discard;
it's just a matter of terminology; in order to determine whether or
not trim/discard is reliable you really have to pay close attention to
the specs, on in the case of SATA, use a whitelist of drive models,
which is crazy.)

- Ted