Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,810,846 Members 37,550 Now Online
XDA Developers Android and Mobile Development Forum

Use of F2FS for /data

Tip us?
 
ss2man44
Old
(Last edited by ss2man44; 3rd February 2014 at 02:46 AM.)
#1  
Member - OP
Thanks Meter 46
Posts: 35
Join Date: Aug 2011
Location: Trenton, GA
Default Use of F2FS for /data

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.
The Following 36 Users Say Thank You to ss2man44 For This Useful Post: [ Click to Expand ]
 
madd0g
Old
#2  
madd0g's Avatar
Senior Member
Thanks Meter 696
Posts: 2,339
Join Date: May 2010
Excellent, hope you'll get around and do it for rest of the Nexus line too (greetings from Reddit). :]
 
Erovia
Old
#3  
Erovia's Avatar
Senior Member
Thanks Meter 247
Posts: 785
Join Date: Sep 2012
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.
Phone: Nexus 4
ROM: ParanoidAndroid 4+
Kernel: hells-Core
Recovery: MultiROM
--------------------------------------------------------------------------------------------------------------------------
Tablet: Nexus 7
ROM: SlimKat 5+
Kernel: LeanKernel
Recovery: MultiROM
--------------------------------------------------------------------------------------------------------------------------
Phone: Motorola Milestone A853 ROM: CyanogenMod 9.1.0d Recovery: Open Recovery MiniMod by -FuFu-
 
sgt. meow
Old
#4  
sgt. meow's Avatar
Recognized Contributor
Thanks Meter 2,787
Posts: 4,339
Join Date: Dec 2011
Location: Dhaka
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.
 

https://www.dropbox.com/s/ho7noezbf3ph0l6/CrossMiranda.png
R.I.P. Miranda Nicole
An innocent soul, who deserved to live a lot longer. We all miss you.

R.I.P Alif Shahriar
A true friend, no longer here in this world, but always there in our hearts. We sorely miss you.


Owner and creator of Oxydo kernels for Nexus 7 2012 (Grouper/Tilapia) and Xperia X8 (Shakira)
Maintainer of AOSPAL for Nexus 7 2012 (Grouper).


My blog: http://alltheengsawesumz.blogspot.com/
Circle or chat: https://plus.google.com/+FayadChowdhury
 
evilspoons
Old
#5  
Member
Thanks Meter 5
Posts: 41
Join Date: 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.
 
ss2man44
Old
#6  
Member - OP
Thanks Meter 46
Posts: 35
Join Date: Aug 2011
Location: Trenton, GA
Quote:
Originally Posted by madd0g View Post
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 View Post
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 View Post
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: [ Click to Expand ]
 
sgt. meow
Old
#7  
sgt. meow's Avatar
Recognized Contributor
Thanks Meter 2,787
Posts: 4,339
Join Date: Dec 2011
Location: Dhaka
Quote:
Originally Posted by ss2man44 View Post
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.
 

https://www.dropbox.com/s/ho7noezbf3ph0l6/CrossMiranda.png
R.I.P. Miranda Nicole
An innocent soul, who deserved to live a lot longer. We all miss you.

R.I.P Alif Shahriar
A true friend, no longer here in this world, but always there in our hearts. We sorely miss you.


Owner and creator of Oxydo kernels for Nexus 7 2012 (Grouper/Tilapia) and Xperia X8 (Shakira)
Maintainer of AOSPAL for Nexus 7 2012 (Grouper).


My blog: http://alltheengsawesumz.blogspot.com/
Circle or chat: https://plus.google.com/+FayadChowdhury
 
sgt. meow
Old
#8  
sgt. meow's Avatar
Recognized Contributor
Thanks Meter 2,787
Posts: 4,339
Join Date: Dec 2011
Location: Dhaka
Quote:
Originally Posted by sgt. meow View Post
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
 

https://www.dropbox.com/s/ho7noezbf3ph0l6/CrossMiranda.png
R.I.P. Miranda Nicole
An innocent soul, who deserved to live a lot longer. We all miss you.

R.I.P Alif Shahriar
A true friend, no longer here in this world, but always there in our hearts. We sorely miss you.


Owner and creator of Oxydo kernels for Nexus 7 2012 (Grouper/Tilapia) and Xperia X8 (Shakira)
Maintainer of AOSPAL for Nexus 7 2012 (Grouper).


My blog: http://alltheengsawesumz.blogspot.com/
Circle or chat: https://plus.google.com/+FayadChowdhury
 
buggatti
Old
#9  
buggatti's Avatar
Senior Member
Thanks Meter 11
Posts: 133
Join Date: 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
G1: Froyo by Lazlo Retired
Nexus S 4g: HellyBean 4.3 Glorified Mp3 PLayer
Nexus 7 2012: KitKat
Nexus 5: KitKat
 
maxq1
Old
#10  
maxq1's Avatar
Senior Member
Thanks Meter 101
Posts: 373
Join Date: May 2010
Location: Manila
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
LG G2 (d802) | CloudyStock (Android 4.4.2) | Dorimanx kernel | PhilzTouch recovery
Nexus 7 (grouper) | Slimkat (Android 4.4.2) | M-kernel | all-F2FS TWRP | all partitions F2FS
Samsung Galaxy S3 (i9300) | ArchiDroid V1.x (Android 4.3) | Devil kernel & recovery | all partitions F2FS << with son >>

The Following 2 Users Say Thank You to maxq1 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes