But what about RAID configurations other than RAID 1, where data is striped or distributed in ways where merely passing along a TRIM command wouldn't make sense?
Interesting question. Basically, you are thinking: a single SSD is easy to send TRIM to, we know the LBA address and it won't change. But with SSDs in RAID, we have to split the TRIM and do other tricks with it, so it is a little harder here. That is true.
But what you think of being difficult, is the prime function of a RAID engine. RAID basically is nothing more than a disk multiplexer. It converts the LBA ranges from multiple disks to one virtual LBA range. So the 'trick' to support TRIM in RAID is very simple. It boils down to the core of the RAID driver functionality: splitting and combining I/O to translate virtual to physical LBA.
If a TRIM request arrives at the RAID engine layer, the RAID layer must split this command just like a READ request or even write request. In most implementations, TRIM is implemented using the same I/O path as other requests, meaning that the same piece of code is used to split a READ request as it is used to split a TRIM request to two or more SSDs.
So what you think of being difficult, is actually the prime function of a RAID engine. It has to 'translate' requests from virtual LBA to physical LBA. That's the primary function of a RAID engine.
Likewise, a filesystem has the prime function of translating character-based storage ("files") to block-based storage ("harddrives"). All these are translations from one domain to the other. Each 'node' only has to know stuff applicable to its own layer only. For example, a RAID engine strictly knows nothing about files or filesystems; it only cares about block storage referenced by LBA.
I generally disagree here. First this is not Windows specific, it is RAID specific issue. The RAID controller is basically acting like a like a huge translation device (among other things like doing XOR etc). Any OS sending "TRIM LBA 000000AF" would have no clue where that data actually sits on the physical disks. The controller would need to do translation which is more complex in anything in above RAID 0,1,10 since the LBA for the file might sit on a stripe that is divided among 3 -> 50 drives.
Same difficulty exists for READ requests, doesn't it? ;-)
I do understand your confusion however, TRIM and RAID are subjects that have a huge amount of misinformation associated with it. Even worse, the information that is correct only applies to one operating system: Windows.
For your information, TRIM on RAID works just fine on RAID0, RAID1, RAID0+1, RAID1+0, RAID5, RAID6 even 'RAID7' in the form of RAID-Z3 triple-parity ZFS 'RAID'. There is nothing that would make TRIM on RAID excessively difficult. In many cases, no change to the RAID layer itself is required. It just translates ATA requests.
In Windows, the operating system uses two interfaces to communicate with device drivers: SCSI and ATA. The latter supports TRIM because TRIM is an ATA ACS2 command. But SCSI does not support TRIM; SCSI supports UNMAP which is equivalent to TRIM. But as far as I know, Windows do not support UNMAP, only TRIM.
So what happens on Windows is that NTFS will generate TRIM requests, but these simply die when communicating with the device driver over SCSI interface. This is a design limitation of the Windows operating system. FreeBSD, by contrast, uses unified ATA/SCSI interface. FreeBSD has the superior GEOM framework which allows I/O to travel down the chain as 'BIO_DELETE' operations. Only at the level of the device driver is this command translated to either:
- TRIM, if on ATA interface
- UNMAP, if on SCSI/SAS interface
- CF ERASE, if used on compactflash storage
In other words, the TRIM requests are not TRIM requests until the lowest level physical layer in software. This is the proper way to implement TRIM. This also means that automatically, all GEOM modules support TRIM. The RAID modules, the encryption modules, the compression modules, the virtualisation modules, etc.
As an example, you can search on OCZ Revodrive. This product comes in three versions (1 and 2, both based on Silicon Image, and version 3 based on LSISAS). All three versions do not support TRIM on Windows 7, because the driver communicates as SCSI not as ATA. Byebye TRIM!
Likewise, if you use the same hardware under non-Windows OS, TRIM will work just fine on all three revodrives. The first two are Silicon Image which only offers RAID through the Windows-only drivers, that is why it is called 'FakeRAID' because the actual hardware is just a normal SATA controller with bootstrapping. The drivers are what provide the RAID functionality, and only under Windows OS. If you boot Linux with Revodrive, you can actually see two or four separate SSDs on Silcon Image controller, instead of one big RAIDed PCIe storage device. In other words: you see the true hardware, not some mere driver which pretends to be something else.
In general, Windows is very outdated in storage technology. Other operating systems like Linux and BSD generally are far ahead in multiple areas. TRIM-support being one of them.