Easily Generate and Export Material Design Palletes

For many people, it can be pretty difficult to create a palette of complementary colors. … more

Android One Expanding to Bangladesh, Nepal, and Sri Lanka

At Google I/O 2013, Google proudly announced that the Android operating system was … more

Android 5.0.2 Fixes 2012 Nexus 7! Sony’s Making a Google Glass Competitor? – XDA TV

Android 5.0.2 Lollipop is available for the … more

Early Lollipop Ports for Micromax A116 and A117

It feels like it was only yesterday when Google announced the mysterious Android L.After … more

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

Some possible insight on the cause of the RFS lag and work-around

OP bilboa1

2nd October 2010, 04:59 PM   |  #1  
OP Recognized Developer
Thanks Meter: 324
 
1,214 posts
Join Date:Joined: Aug 2010
Donate to Me
Since I installed JPK on a test phone after claims that the RFS related lag has been fixed.. well.. I'd like to share my impressions:

- I have installed approx 100 apps after the flash (flashed / wiped / factory reset btw)

A this point, the phone while slightly slower than one with Voodoo is pretty fast

A few days later, it's still good enough.

- 5 days later, lag starts to be felt, and it's stronger every next day until it becomes annoying to use


That's exactly the same experience as I had on various Eclair roms without any lag-fix. I also had this on JP3 (early Froyo).

So yeah. I looked into the /init binary from samsung and it's supposed to make some file system checks from time to time when you restart the phone, but it does not appear to really carry on with that.

So I ran the checks myself:

- you need a rooted phone, and adb or a terminal

- find all RFS partitions:
$ su
# mount|grep -i rfs

- kill all processes, go flight mode and remount them read-only
$ su (if you're not root.. not going to repeat it again for subsequent commands)
# kill -9 <pid> of anything that use the patrition
# mount -oremount,ro /dev/block/....

- check the RFS filesystem and correct errors
# /system/bin/fsck_msdos -p -f /dev/block/....

Surprise, a million of RFS errors fixed such as:

/path/to/file starts with free cluster FIXED
Cluster XXX continues with cluster XXX in FAT 0 but is marked free in FAT 1 FIXED
Detected cluster chain loop head XXXX for p XXXX FIXED
FSNext block XXX is correct NumClusters XXX FIXED (weird one)
No LOST.DIR FIXED
Lost cluster chain at cluster XXX YY clusters lost FIXED (prolly lost files/data here!)

Repeat for each partition

reboot the phone at the end

SURPRISE! It doesn't lag much anymore.

Use the phone an hour, do the check again and you will see it's already full of errors.

Conclusion:

RFS is bugged (we knew that didn't we) but it looks like it's fixable, if ever Samsung figures out what is corrupting the file system exactly (it's closed source so we can't really find out easily)

It might be possible to figure it out by looking at VFAT sources too.


I would be very interested to see if that fixes the lag for everyone or if i'm an isolated case and all my RFS partitions are on bad hardware or if it's really software corruption as I am guessing


Small disclaimer:
im not responsible for any data loss etc. no warranties etc. fixing file system even readonly might cause data loss due to the bugs in RFS. you've been warned lol.
Last edited by bilboa1; 2nd October 2010 at 05:08 PM.
2nd October 2010, 05:24 PM   |  #2  
ragin's Avatar
Senior Member
Flag Hubli
Thanks Meter: 153
 
1,724 posts
Join Date:Joined: Dec 2007
More
My God,

I think a lot of eyes will be on the BOUNTY
2nd October 2010, 05:47 PM   |  #3  
Senior Member
Thanks Meter: 6
 
553 posts
Join Date:Joined: Mar 2010
Could someone just create an app that does this?
2nd October 2010, 06:05 PM   |  #4  
Senior Member
Flag JHB
Thanks Meter: 743
 
2,021 posts
Join Date:Joined: Jan 2006
Quote:
Originally Posted by bilboa1

Since I installed JPK on a test phone after claims that the RFS related lag has been fixed.. well.. I'd like to share my impressions:

- I have installed approx 100 apps after the flash (flashed / wiped / factory reset btw)

A this point, the phone while slightly slower than one with Voodoo is pretty fast

A few days later, it's still good enough.

- 5 days later, lag starts to be felt, and it's stronger every next day until it becomes annoying to use


That's exactly the same experience as I had on various Eclair roms without any lag-fix. I also had this on JP3 (early Froyo).

So yeah. I looked into the /init binary from samsung and it's supposed to make some file system checks from time to time when you restart the phone, but it does not appear to really carry on with that.

So I ran the checks myself:

- you need a rooted phone, and adb or a terminal

- find all RFS partitions:
$ su
# mount|grep -i rfs

- kill all processes, go flight mode and remount them read-only
$ su (if you're not root.. not going to repeat it again for subsequent commands)
# kill -9 <pid> of anything that use the patrition
# mount -oremount,ro /dev/block/....

- check the RFS filesystem and correct errors
# /system/bin/fsck_msdos -p -f /dev/block/....

Surprise, a million of RFS errors fixed such as:

/path/to/file starts with free cluster FIXED
Cluster XXX continues with cluster XXX in FAT 0 but is marked free in FAT 1 FIXED
Detected cluster chain loop head XXXX for p XXXX FIXED
FSNext block XXX is correct NumClusters XXX FIXED (weird one)
No LOST.DIR FIXED
Lost cluster chain at cluster XXX YY clusters lost FIXED (prolly lost files/data here!)

Repeat for each partition

reboot the phone at the end

SURPRISE! It doesn't lag much anymore.

Use the phone an hour, do the check again and you will see it's already full of errors.

Conclusion:

RFS is bugged (we knew that didn't we) but it looks like it's fixable, if ever Samsung figures out what is corrupting the file system exactly (it's closed source so we can't really find out easily)

It might be possible to figure it out by looking at VFAT sources too.


I would be very interested to see if that fixes the lag for everyone or if i'm an isolated case and all my RFS partitions are on bad hardware or if it's really software corruption as I am guessing


Small disclaimer:
im not responsible for any data loss etc. no warranties etc. fixing file system even readonly might cause data loss due to the bugs in RFS. you've been warned lol.

VOLD is what does the RFS check at boot. It seems to run, although maybe it fails? It definitely does run though, you can check it running using 'ps' on phone boot. Maybe it's only cleaning up /sdcard though.

At any rate, running the disk check does help with speed, but it doesn't help that much. It's still slow. I think if you want to stick with RFS, you need to do a defrag as well as the filesystem check. After some use, RFS must be very very fragemented on most people's phones.

Even in perfect condition though, RFS still has some very nasty properties such as locking the entire disk when a write occurs, not doing buffering, etc etc.
2nd October 2010, 06:07 PM   |  #5  
Senior Member
Flag JHB
Thanks Meter: 743
 
2,021 posts
Join Date:Joined: Jan 2006
Quote:
Originally Posted by INeedYourHelp

Could someone just create an app that does this?

An app can't do this, since the app would have to be running off RFS and would crash/have to be killed to perform the FS checks. It could be done on boot using some trickery and the playlogos / replace binary trick. Or it can be done by replacing the init script with some kernel hackery. But at that point, you might as well just use a real filesystem.

I guess a PC .bat file could be made that uses adb to do this for you and then reboot the phone... Doesn't seem worth the trouble though!
2nd October 2010, 06:07 PM   |  #6  
Senior Member
Thanks Meter: 18
 
848 posts
Join Date:Joined: Jul 2010
RFS is journelled. You sure the filesystem doesn't do the journaling properly?
2nd October 2010, 06:11 PM   |  #7  
dakine's Avatar
Senior Member
Thanks Meter: 36
 
714 posts
Join Date:Joined: Nov 2006
Nice job figuring this out. Is someone forwarding all these findings to that Samsung dev?
2nd October 2010, 06:13 PM   |  #8  
OP Recognized Developer
Thanks Meter: 324
 
1,214 posts
Join Date:Joined: Aug 2010
Donate to Me
It's not about RFS vs the other filesystems. I'm well aware of the performance of RFS. But it's decent enough when it's working properly. It's not nearly as fast as ext but fast enough that you don't get annoyed.

Thus fixing RFS would make the life of many people who aren't technically inclined better. If the RFS do get all corrupted everywhere, and Samsung figure that out and fixes it, it means a good thing for most people.

The rest of us will end up on ext anyways

And yeah I think the fscheck at boot fails, it must fail actually, i don't see how else it would happen.
2nd October 2010, 06:23 PM   |  #9  
Senior Member
Flag JHB
Thanks Meter: 743
 
2,021 posts
Join Date:Joined: Jan 2006
Quote:
Originally Posted by bilboa1

It's not about RFS vs the other filesystems. I'm well aware of the performance of RFS. But it's decent enough when it's working properly. It's not nearly as fast as ext but fast enough that you don't get annoyed.

Thus fixing RFS would make the life of many people who aren't technically inclined better. If the RFS do get all corrupted everywhere, and Samsung figure that out and fixes it, it means a good thing for most people.

The rest of us will end up on ext anyways

And yeah I think the fscheck at boot fails, it must fail actually, i don't see how else it would happen.

What firmware did you test on, btw? I've noticed that JPK does seem to take longer on the FS checks, so maybe they have it fixed already (doubt it though)?
2nd October 2010, 07:40 PM   |  #10  
OP Recognized Developer
Thanks Meter: 324
 
1,214 posts
Join Date:Joined: Aug 2010
Donate to Me
Quote:
Originally Posted by RyanZA

What firmware did you test on, btw? I've noticed that JPK does seem to take longer on the FS checks, so maybe they have it fixed already (doubt it though)?

on JPK actually
im going to flash JM8 to see if its the same in fact, but i expect so

Post Reply Subscribe to Thread

Tags
rfs lag
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes