<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 11, 2014 at 10:36 PM, Emmanuel Dreyfus <span dir="ltr">&lt;<a href="mailto:manu@netbsd.org" target="_blank">manu@netbsd.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">Anand Avati &lt;<a href="mailto:avati@gluster.org">avati@gluster.org</a>&gt; wrote:<br>

<br>
&gt; If FUSE implements proper direct_io semantics (somewhat like how O_DIRECT<br>
&gt; flag is handled) and allows the mode to be enabled by the FS in open_cbk,<br>
&gt; then I guess such a special handling of 0-byte need not be necessary?<br>
<br>
</div>Yes, this is how it should be done.<br>
<br>
While there I see there is a FUSE_FOPEN_KEEP_CACHE  and<br>
FUSE_FOPEN_NONSEEKABLE. I assume the later means seek should return an<br>
error (which one?), but what does the first one do?<br>
<br>
There is no real documentation about this aside from Linux kernel<br>
sources...</blockquote><div><br></div><div>In Linux FUSE, an open() call automatically invalidates all pages of that inode. However if FOPEN_KEEP_CACHE is set in open_cbk, the page cache is kept intact (assuming mtime has not changed etc.)</div>
<div><br></div><div>See <a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/fuse/file.c#n207">https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/fuse/file.c#n207</a></div>
<div><br></div><div>Thanks</div></div></div></div>