The folk over at AnandTech have written about Android 4.3 supporting TRIM across Nexus devices. Why is this important? Read on.
When information is deleted from a drive, it’s usually not really deleted, rather the data blocks that are used are flagged as no longer in use. This traditional way of consuming and disposing of data becomes a problem for SSDs that can result in performance drops. Wikipedia has a fairly good explanation of this:
SSDs store data in flash memory cells that are grouped into pages, with the pages (typically 4 kB each) grouped together into blocks (typically 128 pages per block, totalling 512 kB). NAND flash memory cells can only be directly written to when they are empty. If they are considered to contain data, the contents first need to be erased before a write operation can be performed reliably. In SSDs, a write operation can be done on the page-level, but due to hardware limitations, erase commands always affect entire blocks. As a result, writing data to SSD media is very fast as long as empty pages can be used, but slows down considerably once previously written pages need to be overwritten. Since an erase of the cells in the page is needed before it can be written again, but only entire blocks can be erased, an overwrite will initiate a read-erase-modify-write cycle: the contents of the entire block have to be stored in cache before it is effectively erased on the flash medium, then the overwritten page is modified in the cache so the cached block is up to date, and only then is the entire block (with updated page) written to the flash medium. This phenomenon is known as write amplification
To put simply, the more you use your solid state drive, adding, deleting and moving data the slower it gets. Slow storage I/O performance issues on Android devices ring a bell? This is where TRIM comes in. TRIM is a operating system command that tells the drive that the unused blocks can be erased. On a PC, the controller would then schedule the erase of those blocks which in turn improves the SSD performance.
How this will work on Android is yet to be seen but as reported on AnandTech, a reader has found reference to fstrim inside the Android volume daemon.
Fstrim sends the FITRIM ioctl() command to all writable filesystems when invoked, which discards (TRIMs) blocks on the eMMC not used by the filesystem.
If you want to see whether your device is running fstrim, you can do this via adb:
adb logcat -d | grep -i fstrim
Whether it will be implemented on all devices with the release of Android 4.3 is yet to be seen as it depends on the controller used. But certainly for new devices, you would expect it to be a consideration. Re-flashing or restoring to factory defaults just to get your device running fast again could soon become a thing of the past for some.