I didn't realize I hijack the thread. Sorry about that. I can use fsync() or sync(). However, power can be turned off at any time even during the sync() in the embedded systems. So I think using backup file is necessary to recover from corrupt files.
UBIFS doesn't have this type of problems? Regards, Allen -----Original Message----- From: uclinux-dev-boun...@uclinux.org [mailto:uclinux-dev-boun...@uclinux.org] On Behalf Of Allon Stern Sent: Thursday, October 15, 2009 8:53 AM To: uClinux development list Subject: Re: [uClinux-dev] JFFS2 file corrupt at power down. On Oct 14, 2009, at 1:04 PM, Allen Yang wrote: > The problem I have now is sometimes the XML files get corrupted when > board is powered down. The corrupt XML file size is 0 or only a > portion > of the good file size. > > Is JFFS2 supposed to be power down safe? Maybe I missed something when > using JFFS2. (thread hijacking aside) I had a number of problems with JFFS2 on my uClinux board; we ended up switching to UBIFS, which seems to handle powerdowns pretty well. Filesystem notwithstanding, make sure that any changes you want committed are followed up with an fsync. If you don't fsync, then there's a chance that the write will be cached in memory and lost before being stored persistently. This is true for any filesystem. - allon _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev