Skip to content

Commit

Permalink
add option to enable kernel writeback cache
Browse files Browse the repository at this point in the history
  • Loading branch information
davies authored and jiefenghuang committed Sep 13, 2024
1 parent b896617 commit b58ceb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fuse/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions fuse/opcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b58ceb4

Please sign in to comment.