www.smartbusinesschoices.com

Leading Business and Technology,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

jffs2 question
   Smart Linux Business Choices! - the Best of UseNet Postings! Forum Index -> Linux Embedded  
View previous topic :: View next topic  
Author Message
pes
Guest






PostPosted: Tue Sep 23, 2008 6:07 pm    Post subject: jffs2 question Reply with quote

Hi,

When i write to a file which is on JFFS2 file system with a C function,
can I reboot the system immediately after having closed the file by C
function ?

Or in other words, at which moment Linux write the file on my flash memory?


Thanks to explain me.
Back to top
zix
Guest






PostPosted: Tue Sep 23, 2008 6:07 pm    Post subject: Re: jffs2 question Reply with quote

On Sep 23, 6:07 pm, pes <n...@none.com> wrote:
Quote:
Hi,

When i write to a file which is on JFFS2 file system with a C function,
can I reboot the system immediately after having closed the file by C
function ?

Or in other words, at which moment Linux write the file on my flash memory?

Thanks to explain me.

should not be an issue, after u close it, the driver makes sure every
jobs done before closing the file handle
Back to top
przemek klosowski
Guest






PostPosted: Wed Sep 24, 2008 7:08 am    Post subject: Re: jffs2 question Reply with quote

On Tue, 23 Sep 2008 15:07:49 +0200, pes wrote:

Quote:
When i write to a file which is on JFFS2 file system with a C function,
can I reboot the system immediately after having closed the file by C
function ?

Or in other words, at which moment Linux write the file on my flash
memory?

After your function, which is really a system call wrapped via libc,
closes the file, it is handled by the filesystem code in the kernel.
It goes through the VFS layer, which normally uses buffer cache, so
the file may not be all written out. The metadata (the filesystem data
that describes that the file exists, etc), is typically journalled,
so even if not written out, it should still be there because replaying
the journal on reboot will get it. This is not true for data in most
cases. To remediate, you should sync(), which causes the buffer cache
to be written out to disk.



--
Przemek Klosowski, Ph.D. <przemek.klosowski at gmail>
Back to top
Michael Schnell
Guest






PostPosted: Wed Sep 24, 2008 2:06 pm    Post subject: Re: jffs2 question Reply with quote

Rebooting the system is supposed to flush all filesystem caches, so
supposedly JFFS2 is not a problem.

But JFFS2 usually sits on an MTD driver. In my system I see a
"mtdblockd" daemon running. I suppose same asynchronously handles
requests to write to the flash. Same will receive a stop signal when
rebooting and might or might not finish it's work (writing data into the
flash and waiting for each data block to be ready) decently.

Maybe there is an interface to monitor mtdblockd and it might be a good
idea to delay the reboot until it's idle.

-Michael
Back to top
pes
Guest






PostPosted: Wed Sep 24, 2008 5:25 pm    Post subject: Re: jffs2 question Reply with quote

Michael Schnell wrote:
Quote:
Rebooting the system is supposed to flush all filesystem caches, so
supposedly JFFS2 is not a problem.

But JFFS2 usually sits on an MTD driver. In my system I see a
"mtdblockd" daemon running. I suppose same asynchronously handles
requests to write to the flash. Same will receive a stop signal when
rebooting and might or might not finish it's work (writing data into the
flash and waiting for each data block to be ready) decently.

Maybe there is an interface to monitor mtdblockd and it might be a good
idea to delay the reboot until it's idle.

-Michael


Thanks to all for explanations. I will do a sync before my reboot.
I think data are not flushed because I d a force reboot ( # reboot -f)
Back to top
Display posts from previous:   
   Smart Linux Business Choices! - the Best of UseNet Postings! Forum Index -> Linux Embedded  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum