1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 18:43:50 +00:00

mount,cmount,mount2: add --direct-io flag to force uncached access

This change adds the --direct-io flag to the mount. This means the
page cache is completely bypassed for reads and writes. No read-ahead
takes place. Shared mmap is disabled.

This is useful to accurately read files which may change length
frequently on the source.
This commit is contained in:
Nick Craig-Wood
2024-03-04 11:37:18 +00:00
parent f3f743c3f9
commit a67688dcc7
5 changed files with 15 additions and 2 deletions

View File

@@ -158,6 +158,9 @@ func (n *Node) Open(ctx context.Context, flags uint32) (fh fusefs.FileHandle, fu
if entry := n.node.DirEntry(); entry != nil && entry.Size() < 0 {
fuseFlags |= fuse.FOPEN_DIRECT_IO
}
if n.fsys.opt.DirectIO {
fuseFlags |= fuse.FOPEN_DIRECT_IO
}
return newFileHandle(handle, n.fsys), fuseFlags, 0
}