<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 11, 2014 at 7:37 PM, Harshavardhana <span dir="ltr">&lt;<a href="mailto:harsha@harshavardhana.net" target="_blank">harsha@harshavardhana.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">&gt; But there is something I don&#39;t get withthe fix:<br>
&gt; - the code forces direct IO if (state-&gt;flags &amp; O_ACCMODE) != O_RDONLY),<br>
&gt; but here the file is open read/only, hence I would expect fuse xlator to<br>
&gt; do nothing special<br>
<br>
</div>direct_io_mode(xdata) is in-fact gf_true here for &#39;meta&#39;<br>
<div class=""><br>
&gt; - using direct IO is the kernel&#39;s decision, reflecting the flags used by<br>
&gt; calling process on open(2). How can the fuse xlator convince the kernel<br>
&gt; to enable it?<br>
&gt;<br>
<br>
</div>fuse is convinced by &quot;FOPEN_DIRECT_IO&quot;  which is pro-actively set when<br>
&#39;xdata&#39; is set with<br>
&quot;direct-io-mode&quot; to &quot;1&quot; by meta module.<br>
<br>
>From FreeBSD fuse4bsd code<br>
<br>
void<br>
fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)<br>
{<br>
        /*<br>
         * Funcation is called for every vnode open.<br>
         * Merge fuse_open_flags it may be 0<br>
         *<br>
         * XXXIP: Handle FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE<br>
         */<br>
<br>
        if (vnode_vtype(vp) == VREG) {<br>
                /* XXXIP prevent getattr, by using cached node size */<br>
                vnode_create_vobject(vp, 0, td);<br>
        }<br>
}<br>
<br>
<br>
FUSE4BSD seems like doesn&#39;t even implement this as full functionality.<br>
Only getpages/putpages API seems to implement &quot;IO_DIRECT&quot; handling.<br>
Need to see if indeed such is the case.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>I think you found it right. fuse4bsd should start handling FOPEN_DIRECT_IO in the open handler.</div><div><br></div></div></div></div>