<div dir="ltr">We use RFS on a RAM data recorder on one of our missions ( MMS satellites ). If we know the processor is going to be rebooted ( exception, commanded reset, etc ) the code closes all open files and calls rtems_bdbuf_syncdev to flush the buffer cache. <div><br></div><div>If we get an unexpected reset or watchdog, there is not much we can do. That is where a journaling system would come in, but I would imagine it has a performance overhead. </div><div><br></div><div>I don't think we have had many resets at all in over a year on orbit. ( maybe one reset in one of the four sats? ) </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 8:01 PM, Chris Johns <span dir="ltr"><<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 09/05/2016 15:32, Mohammed Saeed Khoory wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I'm using RFS on a RAMDisk for a LEON3-based system. My program tends to keep files open while writing to them periodically. I've noticed that if the system was reset, the files that were open lose all of the data that was written since they were last open. The files still exist in the filesystem, just with a size of 0. Interestingly however, the free space blocks used by those writes are not reclaimed and is gone, and the only way to get it back from what I can tell is to reformat. An fsck-style tool would probably work too but that doesn't exist.<br>
<br>
The way I work around this is that instead of keeping files open, I open the file, write a little, then close instantly. The changes are then preserved in the filesystem if a reset occurs. However, this method is rather awkward, and I was wondering if there's a better way of doing it. I've tried using fflush() and sync(), but that didn't help. Is there a proper way to "synchronize" the writes to the filesystem?<br>
<br>
</blockquote>
<br></span>
I seem to remember duplicating the fd with a dup2 call (I think) and then closing the new fd should help. This flushes out the libc parts. The RFS does not hold any unwritten data, it is pushed to the cache. You will still need to sync the block cache layer. See the 'blksync' command in the shell for code on how to do this.<br>
<br>
As Sebastian points out there is a limit to what can be achieved as the RFS does not have a journal. How this effects your systems is something you will need to determine.<span class="HOEnZb"><font color="#888888"><br>
<br>
Chris</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>