Reimplement -serialize_reads flag using new SyncRead mount flag

Let the kernel do the work for us.

See 15a8bb029a
for more info.
This commit is contained in:
Jakob Unterwurzacher 2021-08-30 09:53:36 +02:00
parent b83ca9c921
commit a99051b324
2 changed files with 8 additions and 3 deletions

View File

@ -26,8 +26,6 @@ type Args struct {
ConfigCustom bool ConfigCustom bool
// NoPrealloc disables automatic preallocation before writing // NoPrealloc disables automatic preallocation before writing
NoPrealloc bool NoPrealloc bool
// Try to serialize read operations, "-serialize_reads"
SerializeReads bool
// Force decode even if integrity check fails (openSSL only) // Force decode even if integrity check fails (openSSL only)
ForceDecode bool ForceDecode bool
// Exclude is a list of paths to make inaccessible, starting match at // Exclude is a list of paths to make inaccessible, starting match at

View File

@ -273,7 +273,6 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f
LongNames: args.longnames, LongNames: args.longnames,
ConfigCustom: args._configCustom, ConfigCustom: args._configCustom,
NoPrealloc: args.noprealloc, NoPrealloc: args.noprealloc,
SerializeReads: args.serialize_reads,
ForceDecode: args.forcedecode, ForceDecode: args.forcedecode,
ForceOwner: args._forceOwner, ForceOwner: args._forceOwner,
Exclude: args.exclude, Exclude: args.exclude,
@ -377,6 +376,14 @@ func initGoFuse(rootNode fs.InodeEmbedder, args *argContainer) *fuse.Server {
MaxWrite: fuse.MAX_KERNEL_WRITE, MaxWrite: fuse.MAX_KERNEL_WRITE,
Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)}, Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)},
Debug: args.fusedebug, 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 mOpts := &fuseOpts.MountOptions