<div dir="ltr"><div class="gmail_extra">Hello!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 1, 2014 at 4:32 PM, Magnus Ahltorp <span dir="ltr"><<a href="mailto:map@kth.se" target="_blank">map@kth.se</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
1) Since directories are not openable with file:open, it is not possible to fsync directories. This is a problem, since fsync() doesn't necessarily ensure that the directory entry of a newly created file has reached the disk.<br>
</blockquote><div> </div><div>As stated in this thread there is no way to do this cross-platform, so if you need this functionality and it is available on your OS I would suggest writing a small nif.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) fsync() blocks the thread that executes it until the data is submitted to the disk. A number of Erlang processes doing fsync() could totally wreck the realtime performance of the system, since fsync() can take a long time.<br>
</blockquote><div> </div><div>If you make sure that you open all the sensitive files with the [raw] option and have "enough" async threads to deal with the fsyncs that are in progress then only the Erlang process issuing the command will be blocked. All other processes will continue running, keeping their realtime guarantees. If you do not use [raw], or have too few async threads that you might see queues growing and the overall latency of file operations will increase. It will however not effect non-file related things.</div>
<div><br></div><div>Also you might want to consider using the [{sync,true}] option to file:open.</div><div><br></div><div>Lukas</div></div></div></div>