Skip to content

Commit a99051b

Browse files
committed
Reimplement -serialize_reads flag using new SyncRead mount flag
Let the kernel do the work for us. See hanwen/go-fuse@15a8bb0 for more info.
1 parent b83ca9c commit a99051b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

internal/fusefrontend/args.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ type Args struct {
2626
ConfigCustom bool
2727
// NoPrealloc disables automatic preallocation before writing
2828
NoPrealloc bool
29-
// Try to serialize read operations, "-serialize_reads"
30-
SerializeReads bool
3129
// Force decode even if integrity check fails (openSSL only)
3230
ForceDecode bool
3331
// Exclude is a list of paths to make inaccessible, starting match at

mount.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f
273273
LongNames: args.longnames,
274274
ConfigCustom: args._configCustom,
275275
NoPrealloc: args.noprealloc,
276-
SerializeReads: args.serialize_reads,
277276
ForceDecode: args.forcedecode,
278277
ForceOwner: args._forceOwner,
279278
Exclude: args.exclude,
@@ -377,6 +376,14 @@ func initGoFuse(rootNode fs.InodeEmbedder, args *argContainer) *fuse.Server {
377376
MaxWrite: fuse.MAX_KERNEL_WRITE,
378377
Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)},
379378
Debug: args.fusedebug,
379+
// The kernel usually submits multiple read requests in parallel,
380+
// which means we serve them in any order. Out-of-order reads are
381+
// expensive on some backing network filesystems
382+
// ( https://github.com/rfjakob/gocryptfs/issues/92 ).
383+
//
384+
// Setting SyncRead disables FUSE_CAP_ASYNC_READ. This makes the kernel
385+
// do everything in-order without parallelism.
386+
SyncRead: args.serialize_reads,
380387
}
381388

382389
mOpts := &fuseOpts.MountOptions

0 commit comments

Comments
 (0)