# What's Fsync?



## monky_1 (Aug 26, 2011)

What the hell is it? Do I save more battery life if it is enabled?


----------



## nativi (Jul 23, 2011)

Facebook sync??? I don't know but I like to find out!

Sent from my Galaxy Nexus using Tapatalk 2


----------



## monky_1 (Aug 26, 2011)

No its in ICS kernels some devs have them enabled and some have them disabled. Francisco just enabled it in he's kernel I believe.


----------



## JkdJEdi (Jun 7, 2011)

monky_1 said:


> No its in ICS kernels some devs have them enabled and some have them disabled. Francisco just enabled it in he's kernel I believe.


 He mentioned a "Security Fix" on his last update, this might have been it. Just did a quick GOOGLE and now I'm more convinced that it was the security fix

[background=rgb(76, 76, 76)]File Synchronizing between PC and your phone, file browsing and working with FTP has never been easier. FSync (Beta) is a file synchronizer, browser and an FTP client for Android powered phones. It manages several FTP servers, supports FTPS - FTP over TLS/SSL in active and passive mode and securely stores user Credentials.[/background]​
And a more info that you'll ever want to read....

Android will do the sync when it needs to -- such as when the screen turns off, shutting down the device, etc. If you are just looking at "normal" operation, explicit sync by applications is never needed.
The problem comes when the user pulls the battery out of their device (or does a hard reset of the kernel), and you want to ensure you don't lose any data.
So the first thing to realize: the issue is when power is suddenly lost, so a clean shutdown can not happen, and the question of what is going to happen in persistent storage at that point.
If you are just writing a single independent new file, it doesn't really matter what you do. The user could have pulled the battery while you were in the middle of writing, right before you started writing, etc. If you don't sync, it just means there is some longer time from when you are done writing during which pulling the battery will lose the data.
The big concern here is when you want to update a file. In that case, when you next read the file you want to have _either_ the _previous_ contents, _or_ the _new_ contents. You don't want to get something half-way written, or lose the data.
This is often done by writing the data in a new file, and then switching to that from the old file. Prior to ext4 you knew that, once you had finished writing a file, further operations on other files would not go on disk until the ones on that file, so you could safely delete the previous file or otherwise do operations that depend on your new file being fully written.
However now if you write the new file, then delete the old one, and the battery is pulled, when you next boot you may see that the old file is deleted and new file created but the contents of the new file is not complete. By doing the sync, you ensure that the new file is completely written at that point so can do further changes (such as deleting the old file) that depend on that state.


----------



## yarly (Jun 22, 2011)

Francos kernel has fsync disabled by default. It's enabled by default on every other kernel. He finally did give users the option to enable it though as of today. I still think he should add a spot to his thread though telling users about what fsync does and why they would enable/disable it (and how to do that without his app).



JkdJEdi said:


> He mentioned a "Security Fix" on his last update, this might have been it. Just did a quick GOOGLE and now I'm more convinced that it was the security fix
> 
> [background=rgb(76, 76, 76)]File Synchronizing between PC and your phone, file browsing and working with FTP has never been easier. FSync (Beta) is a file synchronizer, browser and an FTP client for Android powered phones. It manages several FTP servers, supports FTPS - FTP over TLS/SSL in active and passive mode and securely stores user Credentials.[/background]​


You sort of have the right idea, but wrong application/process. fsync is a process that happens within any linux kernel (see the git repostory link above for more info). My post about it: http://rootzwiki.com/topic/15793-aospliquidsmooth-ics-v15-rom06242012/page__st__11320__p__749982#entry749982


----------



## creaky24 (Jan 13, 2012)

Thanks, yarly.

Still don't see any place in Franco's app to enable fsync maybe I need to update the kernel from 194.

Sent from my Liquified Nexus


----------



## djd338 (Feb 3, 2012)

I updated to F196 yesterday and have kept the Franco app updated. I also can't find where to enable this. And, I'm still not sure if it's anything I should be concerned about or why it's usually enabled by default, but Franco turns it Off, etc, etc?


----------



## abbofro (Apr 1, 2012)

Ezekeels explanation:










Google Galaxy Nexus (GSM)
ROM: AXIOM HYBRYD M2
Kernel: GLaDOS 1.34


----------



## yarly (Jun 22, 2011)

djd338 said:


> I updated to F196 yesterday and have kept the Franco app updated. I also can't find where to enable this. And, I'm still not sure if it's anything I should be concerned about or why it's usually enabled by default, but Franco turns it Off, etc, etc?


Probably not in his app then yet (I don't use his stuff so cannot say).

EDIT: I saw in his change log you can change it if you're on release 196 or later using this command:


```
echo Y > /sys/module/sync/parameters/fsync_enabled
```


----------

