[Baypiggies] File IO question

Ken Seehart ken at seehart.com
Sat Jul 29 07:27:13 CEST 2006


Thanks everyone for your helpful comments.  A couple of you were asking 
about the hardware
configuration and OS.  I got a response from our hardware vendor that 
answers these questions
and sheds some light on the beating up on FLASH issue.

- Ken Seehart
> Ken,
>
> The Intel specification gives guarantied 100000 write cycle of the FLASH
> memory.  The JFFS2 itself does have "wear leveling" built-in.  According to
> the JFFS2 documentation it actually moves data around for each write to
> achieve that.  It uses CRC check-sum to make sure data written is correct.
> The reason we set up the RAM disk as the root file system instead of using
> the JFFS2 straight as root file system is to minimize the write operation of
> the OS to the FLASH memory. You need to calculate exactly how many writes
> you need to do each hour and try to minimize the write operation as much as
> possible to get best use of the FLASH memory.  You can find more information
> about the JFFS2 at http://sourceware.org/jffs2/jffs2-html/
>
>
> Regards,
>
> Zhong

Aahz wrote:
> On Tue, Jul 25, 2006, Ken Seehart wrote:
>   
>> My question is this: If I write a single byte to a file that contains
>> exactly one byte, can I be sure that a power outage during the write
>> will not render the file unreadable?
>>     
>
> No, you cannot be sure.  What I would do is keep the data in two
> different directories; that makes it more likely that you'll be able to
> recover your data.  Also, what OS are you using?  (Yes, I saw that it was
> Linux, not all Linux is alike.)  You may be able to format the flash disk
> with a filesystem that allows journaling.
>
> Another point: I would use \x00 and \xFF for the byte.
>   
Rick Kwan wrote:
> Is this on top of JFFS2 sitting on top of an MTD-style device?
>
> I believe JFFS2 writes a new copy of the file somewhere, in many cases
> the end of the file system, not on top of the previous incarnation.
> But I would also like to hear a more authoritative answer.  (I'm also
> doing embedded Linux and writing to flash, but building on someone
> else's work.)
>
> --Rick Kwan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/baypiggies/attachments/20060728/ce992cc7/attachment.htm 


More information about the Baypiggies mailing list