Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Use of F2FS for /data

OP ss2man44

3rd February 2014, 01:48 AM   |  #1  
OP Member
Flag Trenton, GA
Thanks Meter: 46
 
35 posts
Join Date:Joined: Aug 2011
More
Back story:
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.

Basically, I took the official Tegra 3 kernel and did this:

KERNEL PATCH

Then modified the stock ROM's fstab like this:

FSTAB

Then I gave TWRP statically-linked f2fs-tools binaries:

F2FS-TOOLS

Then I reformatted /data and away it went:



I'm going to reboot into Linux and attach my boot/TWRP images for you guys to test out. Until then, I'd love to have some feedback.
  • What do you think about using f2fs on the Nexus 7?
  • Is it worth it?
  • What kind of impact on performance or battery life do you think this will have?
  • Did I do something seriously wrong with my kernel/fstab?
  • Am I absolutely insane and dangerous to everyone's Nexus 7 tablets and their puppies?

Image Downloads
Android File Host | Google Drive

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.
  1. Flash boot and recovery like usual:
    Code:
    $ fastboot flash boot boot-F2FS.img
    $ fastboot flash recovery openrecovery-twrp-2.6.3.1-grouper-F2FS.img
  2. Format Data in TWRP
  3. Reboot
  4. Done!
Note that these are for the latest official 4.4.2 build KOT49H.

Let me know how your performance and battery life change after applying this. Storage performance should noticeably increase and battery life change should be negligible.
Last edited by ss2man44; 3rd February 2014 at 03:46 AM.
The Following 36 Users Say Thank You to ss2man44 For This Useful Post: [ View ]
3rd February 2014, 08:22 AM   |  #2  
madd0g's Avatar
Senior Member
Thanks Meter: 700
 
2,351 posts
Join Date:Joined: May 2010
More
Excellent, hope you'll get around and do it for rest of the Nexus line too (greetings from Reddit). :]
3rd February 2014, 12:37 PM   |  #3  
Erovia's Avatar
Senior Member
Thanks Meter: 257
 
805 posts
Join Date:Joined: Sep 2012
More
This actually looks pretty interesting. Do you have any benchmark result?
I hope some of the kernel devs around here will pick up your idea.
3rd February 2014, 12:56 PM   |  #4  
sgt. meow's Avatar
Recognized Contributor
Flag Dhaka
Thanks Meter: 2,846
 
4,347 posts
Join Date:Joined: Dec 2011
More
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.
3rd February 2014, 02:58 PM   |  #5  
Member
Thanks Meter: 5
 
42 posts
Join Date:Joined: Nov 2010
Excellent idea - I'm highly interested in the results. My 2012 N7 is starting to look quite pokey alongside my N5, so if this provides an improvement I'm all over it.
3rd February 2014, 07:22 PM   |  #6  
OP Member
Flag Trenton, GA
Thanks Meter: 46
 
35 posts
Join Date:Joined: Aug 2011
More
Quote:
Originally Posted by madd0g

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.
The Following User Says Thank You to ss2man44 For This Useful Post: [ View ]
7th February 2014, 03:50 PM   |  #7  
sgt. meow's Avatar
Recognized Contributor
Flag Dhaka
Thanks Meter: 2,846
 
4,347 posts
Join Date:Joined: Dec 2011
More
Quote:
Originally Posted by ss2man44

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.
8th February 2014, 04:17 AM   |  #8  
sgt. meow's Avatar
Recognized Contributor
Flag Dhaka
Thanks Meter: 2,846
 
4,347 posts
Join Date:Joined: Dec 2011
More
Quote:
Originally Posted by sgt. meow

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.

Sent from my Nexus 7 using Tapatalk
8th February 2014, 09:21 PM   |  #9  
buggatti's Avatar
Senior Member
Thanks Meter: 12
 
133 posts
Join Date:Joined: Aug 2011
OMG

At first when I tried this I wasn't expecting this great deal of performance just by a file system change but boy was I wrong

The benchmark aren't higher but the the system performance is quite noticeable when using


This combines with FSync Off and nexus 7 will be flying
14th February 2014, 01:36 AM   |  #10  
maxq1's Avatar
Senior Member
Flag Manila
Thanks Meter: 105
 
382 posts
Join Date:Joined: May 2010
More
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

would really like to see this implementation on our beloved n7

The Following 3 Users Say Thank You to maxq1 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes