Index: fuse_node.c =================================================================== --- fuse_node.c (revision 270029) +++ fuse_node.c (working copy) @@ -273,9 +273,27 @@ * Funcation is called for every vnode open. * Merge fuse_open_flags it may be 0 * - * XXXIP: Handle FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE + * XXXIP: Handle FOPEN_KEEP_CACHE */ + /* + * Ideally speaking, direct io should be enabled + * but do not see of any way of providing that in + * this implementation. + * Also cannot think of a reason why would two + * different fd's on same vnode would would like + * have DIRECT_IO turned on and off. But linux + * based implementation works on an fd not an + * inode. + * + * XXXIP: Handle fd based DIRECT_IO + */ + if (fuse_open_flags & FOPEN_DIRECT_IO) { + VTOFUD(vp)->flag |= FN_DIRECTIO; + } else { + VTOFUD(vp)->flag &= ~FN_DIRECTIO; + } + if (vnode_vtype(vp) == VREG) { /* XXXIP prevent getattr, by using cached node size */ vnode_create_vobject(vp, 0, td); Index: fuse_node.h =================================================================== --- fuse_node.h (revision 270029) +++ fuse_node.h (working copy) @@ -67,6 +67,7 @@ #define FN_FLUSHINPROG 0x00000040 #define FN_FLUSHWANT 0x00000080 #define FN_SIZECHANGE 0x00000100 +#define FN_DIRECTIO 0x00000200 struct fuse_vnode_data { /** self **/ Index: fuse_vnops.c =================================================================== --- fuse_vnops.c (revision 270029) +++ fuse_vnops.c (working copy) @@ -1173,6 +1173,11 @@ if (fuse_isdeadfs(vp)) { return ENXIO; } + + if (VTOFUD(vp)->flag & FN_DIRECTIO) { + ioflag |= IO_DIRECT; + } + return fuse_io_dispatch(vp, uio, ioflag, cred); } @@ -1712,6 +1717,10 @@ } fuse_vnode_refreshsize(vp, cred); + if (VTOFUD(vp)->flag & FN_DIRECTIO) { + ioflag |= IO_DIRECT; + } + return fuse_io_dispatch(vp, uio, ioflag, cred); }