TRIM / DISCARD support

Because I (taggart) keep forgetting, I am creating this page to track the details about TRIM / DISCARD support.

DISCARD support for dmcrypt was added to Linux in 3.1.
Support in the dmcrypt tools was added in 1.4.x

The linux commit

commit 772ae5f54d69c38a5e3c4352c5fdbdaff141af21
Author: Milan Broz <mbroz@redhat.com>
Date:   Tue Aug 2 12:32:08 2011 +0100
    dm crypt: optionally support discard requests
    
    Add optional parameter field to dmcrypt table and support
    "allow_discards" option.
    
    Discard requests bypass crypt queue processing. Bio is simple remapped
    to underlying device.
    
    Note that discard will be never enabled by default because of security
    consequences.  It is up to the administrator to enable it for encrypted
    devices.
    
    (Note that userspace cryptsetup does not understand new optional
    parameters yet.  Support for this will come later.  Until then, you
    should use 'dmsetup' to enable and disable this.)