[Galaxy Tab 10.1 Android Development] decatf:
Obsolete. This has been merged into the most recent releases of my ROMs.

TRIM for Galaxy Tab 10.1

These are kernels with TRIM enabled.

Backstory:

In 2011/2012 the eMMC DISCARD operation (aka TRIM) resulted in the SuperBrick bug on this device and many other Samsung devices. Samsung released a fix[1] back then but the Android community was not happy with the way Samsung had treated the them. So it seems that many ROM maintainers did not trust that the issue was fixed. The SuperBrick bug patch was never merged for most devices despite it being merged into the mainline Linux kernel. Instead the indie developers opted to disable the DISCARD operation all together. Since then every major ROM/kernel/recovery for this device has had DISCARD disabled.

Fast forward to the past year and a half or so some developers began to release kernels with the Samsung brickbug patches and renabling the DISCARD operation. The buggy operation that resulted in bricking eMMC cards is the secure DISCARD operation. The plain DISCARD operation is safe. The patch from Samsung simply disables the buggy secure DISCARD.

I have been testing TRIM for this device on my own since shortly after[2] I first released the Lollipop ROM in November 2014. I have not run into any problems since then.

Developer [MENTION=4141005]Lanchon[/MENTION] has been publicly testing[3] it on the Galaxy S2 i9100 for a long time. Recently the DISCARD functionality was officially merged into the CM-13.0 kernel for that device. He also pointed out in a recent post that the lifespan of eMMC cards are adversely affected by write amplification[4] if TRIM is not being used.

So all things considered I think we are overdue for re-enabling the DISCARD operation and having TRIM working for this device.

Additional note:

Wiping in recovery is still safe. Some devices use the same kernel for the ROM and recovery. This device does not. This device has a seperate kernel for the ROM and recovery. So there is zero risk with using this kernel and any recovery that is also itself safe to use.

That was a major concern for devices that use a single kernel for the ROM and recovery but that does not apply to this device. Every recovery I have released to date still has DISCARD completely disabled.

You can find plenty of documentation/articles/threads about the SuperBrick bug saga so I won't write anymore than needs to be said.

[1] https://wiki.cyanogenmod.org/w/EMMC_Bugs

[2] https://github.com/Decatf/android_kernel_samsung_p4/commit/15ca63c60b63a9e6796b9554694c1a2c9aed2a53

[3] http://xdaforums.com/galaxy-s2/development-derivatives/rom-brickbug-aftermath-speeding-t2843238

[4] https://en.wikipedia.org/wiki/Write_amplification

Downloads:

I'm posting these as a separate project because I won't be re-enabling DISCARD in the kernel of my ROM releases until these kernels have been tested publicly for some time.

Standard disclaimer applies. Use this at your own risk!

p4wifi_kernel-aosp-5.1-20150305-TRIM.zip

p4_kernel-aosp-5.1-20150305-TRIM.zip

p4tmo_kernel-aosp-5.1-20150305-TRIM.zip

Only compatible with aosp-6.0.1-20160428 and older. ROMs newer than 20160428 have TRIM included by default.

p4wifi_kernel-aosp-6.0-20160414-TRIM.zip

p4_kernel-aosp-6.0-20160414-TRIM.zip

p4tmo_kernel-aosp-6.0-20160414-TRIM.zip

Using TRIM:

Android runs TRIM automatically (since Lollipop) so you don't need to install any app to do it. You might want to run it manually once after you've installed this kernel since most of your devices probably have never been TRIMed before.

There is a command to do it manually from the terminal. It must be run as root.

$ fstrim -v /data
$ fstrim -v /system
$ fstrim -v /cache

XDA:DevDB Information

TRIM for Galaxy Tab 10.1, Kernel for the Samsung Galaxy Tab 10.1

Contributors

decatf

Kernel Special Features:

Version Information

Status: Testing

Created 2016-03-07

Last Updated 2016-08-23