|
|
Log in / Subscribe / Register

We should not look at discard as an uniform feature in the first place

We should not look at discard as an uniform feature in the first place

Posted May 7, 2019 11:47 UTC (Tue) by hmh (subscriber, #3838)
Parent article: Issues around discard

Sometimes it feels like the real use for "TRIM" ("discard") on FLASH-based, old-style-storage devices with advanced FTLs (i.e. SATA or SAS-attached SSDs) is being forgotten. It is there to *reduce needless copying of stale pages of data* by the SSD itself, i.e. to reduce the need for background block writes. It is not an speedy way to delete data blocks, or if it is, someone forgot to properly notify the device vendors about it -- it is a FLASH endurance saver.

When you either TRIM or overwrite an LBA, the SSD gets the implied information that the old block is not going to be reused, and can be scheduled to be *erased*.

OTOH, when a filesystem prefers to direct writes to a new LBA and TRIM/discard is never done on the old, now-freed blocks, those old blocks are going to be copied around by the SSD firmware to free up erase blocks (much like memory compaction tries to do to create huge pages). This wastes FLASH write circles, increases on-device fragmentation, and reduces the number of "erased and ready to be used" FLASH pages. It also eventually renders the SSD into the dreaded "slow as an old floppy drive" state.

So, what "discard" is really useful for on [old-style non-NVMe?] SSDs is vastly different on why one would use "discard" on, e.g., a thin-provisioned volume. And it is *not* any less important.


to post comments

We should not look at discard as an uniform feature in the first place

Posted May 13, 2019 12:39 UTC (Mon) by Fowl (subscriber, #65667) [Link] (1 responses)

What happens if a write and a discard race?

We should not look at discard as an uniform feature in the first place

Posted May 14, 2019 2:23 UTC (Tue) by hmh (subscriber, #3838) [Link]

It entirely depends on the competence of the vendor that wrote the device firmware, and that whomever designed the queue protocol was not crazy enough to forget about write collisions between queues.

A discard really is just a write as far as ordering and races/collisions go.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds