Use of F2FS for /data

I bought a Moto X during the $100 off promotion and while I was waiting for it to be delivered, I read reviews and poked around online for interesting things about the phone. As an 8GB Nexus 7 owner, the one thing that caught my eye the most was this section of the Anandtech review discussing internal storage performance. Considering how badly my N7's storage performance degraded and how unbearably slow it has become, I felt like it could make good use of this "flash friendly file system." Some Googling revealed that the F2FS driver was developed by Samsung and actually contributed to the official kernel, where it was implemented somewhere around 3.8. I've done some development for an HTC phone in the past, but never for the Nexus 7, so I went and researched the kernel. Because Google's Tegra 3 kernel is based on 3.1, I had to start working on backporting the driver, when I discovered this repository of backports for F2FS. It provides patches for 3.0 and 3.2, but not for 3.1, so I manually applied appropriate changes from each. When I flashed the kernel and booted, it seemed to work, so I went ahead and injected the kernel into the latest TWRP image as well. I also modified the fstab for both the recovery and ROM and compiled Cyanogenmod's f2fs-tools for Android and statically linked them before injecting them into TWRP as well. I then booted into recovery, formatted /data (TWRP knew to use mkfs.f2fs), and booted back into Android. Success, it worked! I've been using my Nexus 7 like this since Friday evening and it's been so much more usable. Not perfectly "like-new" smooth, but it doesn't hang as often or as long.

I haven't seen anyone actually try this yet so I'm hoping my effort will be able to make a difference for N7 owners fed up with slow performance. Switching to f2fs is as easy as flashing a modified kernel and recovery, then doing a factory reset. Also, any interested developer is more than welcome to use anything I post here.

Instructions:WARNING: This process obviously will wipe your data. Make a NANDroid backup beforehand and save it to your computer. While I personally use this, I take no responsibility for damage done to your device.

Excellent, hope you'll get around and do it for rest of the Nexus line too (greetings from Reddit). :]

Unless I get distracted, the plan is to do this for the Nexus 4. My goal is to expose this sort of thing to existing developers and let them handle the logistics. I've always been terrible about sticking to a project.

Quote:

Originally Posted by Erovia

This actually looks pretty interesting. Do you have any benchmark result?

Not yet. This is what I had to sat about benchmarks in the Reddit thread:

Quote:

Originally Posted by ss2man44

The only problem is that the Nexus 7 performs at its worst after the media has been used for a while and filled with data. I'm hoping others will provide their experiences under these conditions, but if need be, I'll do some benchmarks of my own when I have time.

Quote:

Originally Posted by sgt. meow

The kernel devs can integrate the kernel patch and the fstab patch to some extent but definitely not the recovery patch. I'm going to try this tomorrow or the day after.
Great work.

This is exactly what I hoped for when I posted this. Kernel developers can merge this patch and if it gains enough attention, perhaps conventions could be established around specifying which filesystem a kernel/recovery is designed for. Built-from-source recoveries with F2FS support would be nice as well.

Unless I get distracted, the plan is to do this for the Nexus 4. My goal is to expose this sort of thing to existing developers and let them handle the logistics. I've always been terrible about sticking to a project.

Not yet. This is what I had to sat about benchmarks in the Reddit thread:

This is exactly what I hoped for when I posted this. Kernel developers can merge this patch and if it gains enough attention, perhaps conventions could be established around specifying which filesystem a kernel/recovery is designed for. Built-from-source recoveries with F2FS support would be nice as well.

The patch applied cleanly (the second time I've ever seen a patch do that). Good job.
I'll compile and flash to see if it boots (there are issues with my kernels) and if all goes well I'll switch completely to F2FS.

The patch applied cleanly (the second time I've ever seen a patch do that). Good job.
I'll compile and flash to see if it boots (there are issues with my kernels) and if all goes well I'll switch completely to F2FS.

Well it booted on one ROM that has no issues with SELinux and the other didn't boot although the same config without F2FS boots fine. Strange.

f2fs implementation on the note2 and s3 on all partitions: kernel & recovery and a compatible rom for the s3...perhaps you might get some help from those devs. using it on my s3 and the performance has been great. not entirely sold on benchmarks but on ext4 i was getting 14-15k on antutu. w/ f2fs on the same cpu/gpu speeds, i'm getting 18-19k. HTH

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality.Are you a developer?