Add direct io option for file operations

geesefs-0-30-9
Ben Sidhom 2017-04-28 16:38:01 -07:00 committed by Aaron Jacobs
parent bf33916294
commit 025868ecf2
2 changed files with 13 additions and 0 deletions

View File

@ -561,6 +561,10 @@ func (c *Connection) kernelResponseForOp(
out.OpenFlags |= uint32(fusekernel.OpenKeepCache)
}
if o.UseDirectIO {
out.OpenFlags |= uint32(fusekernel.OpenDirectIO)
}
case *fuseops.ReadFileOp:
// convertInMessage already set up the destination buffer to be at the end
// of the out message. We need only shrink to the right size based on how

View File

@ -564,6 +564,15 @@ type OpenFileOp struct {
// is set to true, regardless of its value, at least for files opened in the
// same mode. (Cf. https://github.com/osxfuse/osxfuse/issues/223)
KeepPageCache bool
// Whether to use direct IO for this file handle. By default, the kernel
// suppresses what it sees as redundant operations (including reads beyond
// the precomputed EOF).
//
// Enabling direct IO ensures that all client operations reach the fuse
// layer. This allows for filesystems whose file sizes are not known in
// advance, for example, because contents are generated on the fly.
UseDirectIO bool
}
// Read data from a file previously opened with CreateFile or OpenFile.