main: add "-kernel_cache" flag
This option is similar to fuse(8) kernel_cache Verified using vmtouch. Without -kernel_cache: $ dd if=/dev/zero of=foo bs=1M count=10 ; vmtouch -t foo ; vmtouch foo 10+0 records in 10+0 records out 10485760 bytes (10 MB, 10 MiB) copied, 0,0242321 s, 433 MB/s Files: 1 Directories: 0 Touched Pages: 2560 (10M) Elapsed: 0.011159 seconds Files: 1 Directories: 0 Resident Pages: 0/2560 0/10M 0% Elapsed: 0.000993 seconds With -kernel_cache: $ dd if=/dev/zero of=foo bs=1M count=10 ; vmtouch -t foo ; vmtouch foo 10+0 records in 10+0 records out 10485760 bytes (10 MB, 10 MiB) copied, 0,0244015 s, 430 MB/s Files: 1 Directories: 0 Touched Pages: 2560 (10M) Elapsed: 0.011564 seconds Files: 1 Directories: 0 Resident Pages: 2560/2560 10M/10M 100% Elapsed: 0.000369 seconds
This commit is contained in:
parent
14dac373c2
commit
c20c7992a0
@ -241,6 +241,9 @@ Only for forward mode: automatically unmount the filesystem if it has been idle
|
|||||||
for the specified duration. Durations can be specified like "500s" or "2h45m".
|
for the specified duration. Durations can be specified like "500s" or "2h45m".
|
||||||
0 (the default) means stay mounted indefinitely.
|
0 (the default) means stay mounted indefinitely.
|
||||||
|
|
||||||
|
#### -kernel_cache
|
||||||
|
Enable the kernel_cache option of the FUSE filesystem, see fuse(8) for details.
|
||||||
|
|
||||||
#### -ko
|
#### -ko
|
||||||
Pass additional mount options to the kernel (comma-separated list).
|
Pass additional mount options to the kernel (comma-separated list).
|
||||||
FUSE filesystems are mounted with "nodev,nosuid" by default. If gocryptfs
|
FUSE filesystems are mounted with "nodev,nosuid" by default. If gocryptfs
|
||||||
|
@ -30,7 +30,7 @@ type argContainer struct {
|
|||||||
noprealloc, speed, hkdf, serialize_reads, forcedecode, hh, info,
|
noprealloc, speed, hkdf, serialize_reads, forcedecode, hh, info,
|
||||||
sharedstorage, devrandom, fsck bool
|
sharedstorage, devrandom, fsck bool
|
||||||
// Mount options with opposites
|
// Mount options with opposites
|
||||||
dev, nodev, suid, nosuid, exec, noexec, rw, ro bool
|
dev, nodev, suid, nosuid, exec, noexec, rw, ro, kernel_cache bool
|
||||||
masterkey, mountpoint, cipherdir, cpuprofile,
|
masterkey, mountpoint, cipherdir, cpuprofile,
|
||||||
memprofile, ko, ctlsock, fsname, force_owner, trace, fido2 string
|
memprofile, ko, ctlsock, fsname, force_owner, trace, fido2 string
|
||||||
// -extpass, -badname, -passfile can be passed multiple times
|
// -extpass, -badname, -passfile can be passed multiple times
|
||||||
@ -179,6 +179,7 @@ func parseCliOpts() (args argContainer) {
|
|||||||
flagSet.BoolVar(&args.noexec, "noexec", false, "Deny executables")
|
flagSet.BoolVar(&args.noexec, "noexec", false, "Deny executables")
|
||||||
flagSet.BoolVar(&args.rw, "rw", false, "Mount the filesystem read-write")
|
flagSet.BoolVar(&args.rw, "rw", false, "Mount the filesystem read-write")
|
||||||
flagSet.BoolVar(&args.ro, "ro", false, "Mount the filesystem read-only")
|
flagSet.BoolVar(&args.ro, "ro", false, "Mount the filesystem read-only")
|
||||||
|
flagSet.BoolVar(&args.kernel_cache, "kernel_cache", false, "Enable the FUSE kernel_cache option")
|
||||||
|
|
||||||
flagSet.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key")
|
flagSet.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key")
|
||||||
flagSet.StringVar(&args.cpuprofile, "cpuprofile", "", "Write cpu profile to specified file")
|
flagSet.StringVar(&args.cpuprofile, "cpuprofile", "", "Write cpu profile to specified file")
|
||||||
|
@ -44,4 +44,6 @@ type Args struct {
|
|||||||
// which are a performance problem for writes. See
|
// which are a performance problem for writes. See
|
||||||
// https://github.com/rfjakob/gocryptfs/issues/515 for details.
|
// https://github.com/rfjakob/gocryptfs/issues/515 for details.
|
||||||
Suid bool
|
Suid bool
|
||||||
|
// Enable the FUSE kernel_cache option
|
||||||
|
KernelCache bool
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,10 @@ func (n *Node) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFl
|
|||||||
rn.openWriteOnlyLock.RLock()
|
rn.openWriteOnlyLock.RLock()
|
||||||
defer rn.openWriteOnlyLock.RUnlock()
|
defer rn.openWriteOnlyLock.RUnlock()
|
||||||
|
|
||||||
|
if rn.args.KernelCache {
|
||||||
|
fuseFlags = fuse.FOPEN_KEEP_CACHE
|
||||||
|
}
|
||||||
|
|
||||||
// Open backing file
|
// Open backing file
|
||||||
fd, err := syscallcompat.Openat(dirfd, cName, newFlags, 0)
|
fd, err := syscallcompat.Openat(dirfd, cName, newFlags, 0)
|
||||||
// Handle a few specific errors
|
// Handle a few specific errors
|
||||||
|
1
mount.go
1
mount.go
@ -267,6 +267,7 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f
|
|||||||
ExcludeWildcard: args.excludeWildcard,
|
ExcludeWildcard: args.excludeWildcard,
|
||||||
ExcludeFrom: args.excludeFrom,
|
ExcludeFrom: args.excludeFrom,
|
||||||
Suid: args.suid,
|
Suid: args.suid,
|
||||||
|
KernelCache: args.kernel_cache,
|
||||||
}
|
}
|
||||||
// confFile is nil when "-zerokey" or "-masterkey" was used
|
// confFile is nil when "-zerokey" or "-masterkey" was used
|
||||||
if confFile != nil {
|
if confFile != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user