Skip to content

Commit

Permalink
Reimplement -serialize_reads flag using new SyncRead mount flag
Browse files Browse the repository at this point in the history
Let the kernel do the work for us.

See hanwen/go-fuse@15a8bb0
for more info.
  • Loading branch information
rfjakob committed Aug 30, 2021
1 parent b83ca9c commit a99051b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 0 additions & 2 deletions internal/fusefrontend/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type Args struct {
ConfigCustom bool
// NoPrealloc disables automatic preallocation before writing
NoPrealloc bool
// Try to serialize read operations, "-serialize_reads"
SerializeReads bool
// Force decode even if integrity check fails (openSSL only)
ForceDecode bool
// Exclude is a list of paths to make inaccessible, starting match at
Expand Down
9 changes: 8 additions & 1 deletion mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f
LongNames: args.longnames,
ConfigCustom: args._configCustom,
NoPrealloc: args.noprealloc,
SerializeReads: args.serialize_reads,
ForceDecode: args.forcedecode,
ForceOwner: args._forceOwner,
Exclude: args.exclude,
Expand Down Expand Up @@ -377,6 +376,14 @@ func initGoFuse(rootNode fs.InodeEmbedder, args *argContainer) *fuse.Server {
MaxWrite: fuse.MAX_KERNEL_WRITE,
Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)},
Debug: args.fusedebug,
// The kernel usually submits multiple read requests in parallel,
// which means we serve them in any order. Out-of-order reads are
// expensive on some backing network filesystems
// ( https://github.com/rfjakob/gocryptfs/issues/92 ).
//
// Setting SyncRead disables FUSE_CAP_ASYNC_READ. This makes the kernel
// do everything in-order without parallelism.
SyncRead: args.serialize_reads,
}

mOpts := &fuseOpts.MountOptions
Expand Down

0 comments on commit a99051b

Please sign in to comment.