TRIM – A Trim command is issued by an operating system and tells an SSD which blocks containng data can be deleted. A subsequent deleted data block reclamation process run by the SSD controller, known as garbage collection, can then be carried out on the basis of known deleted blocks.Otherwise the SSD controller would not know which blocks contained data in use and data no longer needed.
Blocks have addresses; the Logical Block Address or LBA. A host-issued TRI command tells the SSDs to mark an LBA as invalid; to set the pages within it to be invalid. Any reads to those pages following the TRIM command will find no data there. The TRim command is called ‘Deallocate’ in the NVMe protocol and ‘Unmap’ in SCSI and SAS protocols.
A host-issued TRIM command tells the flash controller that a whole block can be erased and made available for re-use. Without it the SSD controller has to track invalid (deleted) pages in a block and carry out garbage collection in the background, to collect all the valid data from a block, rewriting it to a fresh block, and then erasing the old block. The TRIM command says all the pages in the block are invalid, so it can be erased with no data rewriting burden.