Keep in mind that discard is our high level mechanism that is used by the file system layer to inform the IO stack about what is in use or not in use.
For real, physical devices, they have to support the relevant command in their firmware (TRIM for ATA, or WRITE_SAME with UNMAP or UNMAP for SCSI). So far, we have seen that TRIM support has been enabled in many S-ATA SSD's and in a few SCSI based arrays (with others coming). As far as I know, no traditional, single spindle drives implement this.
We definitely could implement a software only layer that is "discard" aware (the device mapper I think is looking at doing this).
I would say that we definitely need both online discard and batched discard. Some devices will really benefit from the online discard (and have no problems with it), others might only do well with batched and some will do best with a both :)
Posted Dec 11, 2010 16:44 UTC (Sat) by Lennie (subscriber, #49641)
[Link]
I think the way for SSD's to implement TRIM is to immediately accept the commands, so it doesn't block. Buffer it and start to clean up when they 'feel the time is right'. I think SSD's could be smart enough to do this.
It doesn't seem that complicated for me, so maybe this is something Chris Mason thinks as well.