Tuesday, 30 July 2013

Google Quietly Added Built-In TRIM Support In Android 4.3 – Should Fix Most Storage-Related Device Slowdowns

Many users of the original Nexus 7 remember how slow the device could get after a few months of heavy use. At least part of this problem has to do with the way NAND flash stores and deletes data. Android 4.3 comes with a little-hyped feature that could be huge for performance in the future – TRIM support via fstrim.
2013-07-29 20_33_28-b87937cdea689594a293979b30b13054e7455dee - platform_system_vold - Git at Google
There were ways to run the fstrim command on devices before, but it required root. Then, by the time you realized you needed it, the file system was probably already a mess. TRIM is important in solid state storage because deleting a file doesn't really remove it, the storage device simply allows you to re-use the blocks. The controller considers that data still valid, so as you write and delete more blocks, the NAND controller has to keep track of a more complex map of locations in the file system. The result? Slow storage.
TRIM goes through your flash storage and tells the controller to stop tracking those blocks of data you have "deleted." The controller will then (ideally) schedule that data to be swept up in the next garbage collection cycle. This process is now happening in the background of Nexus devices running Android 4.3. It should even show up in the logcat on occasion.
The commits in AOSP that list fstrim are in platform/system, so it's safe to say this is going to be a part of all Android devices on 4.3 – not just the Nexus series. The fstrim application will tick along in the background, so it might take a while for any difference to become clear on already sluggish devices. However, fresh phones and tablets should not suffer from the same kind of slowdowns we saw with the first N7 – assuming the storage controller is up to the task.

No comments:

Post a Comment