<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"><<a href="mailto:harsha@harshavardhana.net" target="_blank">harsha@harshavardhana.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">> But there is something I don't get withthe fix:<br>
> - the code forces direct IO if (state->flags & O_ACCMODE) != O_RDONLY),<br>
> but here the file is open read/only, hence I would expect fuse xlator to<br>
> do nothing special<br>
<br>
</div>direct_io_mode(xdata) is in-fact gf_true here for 'meta'<br>
<div class=""><br>
> - using direct IO is the kernel's decision, reflecting the flags used by<br>
> calling process on open(2). How can the fuse xlator convince the kernel<br>
> to enable it?<br>
><br>
<br>
</div>fuse is convinced by "FOPEN_DIRECT_IO" which is pro-actively set when<br>
'xdata' is set with<br>
"direct-io-mode" to "1" 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't even implement this as full functionality.<br>
Only getpages/putpages API seems to implement "IO_DIRECT" 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>