diff --git a/fuse/api.go b/fuse/api.go index 33de2bc5..56510361 100644 --- a/fuse/api.go +++ b/fuse/api.go @@ -284,6 +284,13 @@ type MountOptions struct { // directory queries (i.e. 'ls' without '-l') can be faster with // ReadDir, as no per-file stat calls are needed DisableReadDirPlus bool + + // EnableWriteback enables kernel writeback cache. + // + // See writeback-cache in + // https://www.kernel.org/doc/Documentation/filesystems/fuse-io.txt + // for more details. + EnableWriteback bool } // RawFileSystem is an interface close to the FUSE wire protocol. diff --git a/fuse/opcode.go b/fuse/opcode.go index f4e3ea56..8ecb3319 100644 --- a/fuse/opcode.go +++ b/fuse/opcode.go @@ -114,6 +114,9 @@ func doInit(server *Server, req *request) { if server.opts.EnableAcl { kernelFlags |= CAP_POSIX_ACL } + if server.opts.EnableWriteback { + kernelFlags |= CAP_WRITEBACK_CACHE + } if server.opts.SyncRead { // Clear CAP_ASYNC_READ kernelFlags &= ^uint64(CAP_ASYNC_READ)