Force -noprealloc on Btrfs
Preallocation on Btrfs is broken ( https://github.com/rfjakob/gocryptfs/issues/395 , https://lore.kernel.org/linux-btrfs/CAPv9Zmk46As_P9Gyf_icET53xRda63h7iC1meES9xbdDEt9qow@mail.gmail.com/ ) and slow ( https://github.com/rfjakob/gocryptfs/issues/63 ).
This commit is contained in:
parent
abb2f1fad0
commit
13055278f5
14
mount.go
14
mount.go
@ -19,6 +19,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/hanwen/go-fuse/fuse"
|
||||
"github.com/hanwen/go-fuse/fuse/nodefs"
|
||||
"github.com/hanwen/go-fuse/fuse/pathfs"
|
||||
@ -95,6 +97,18 @@ func doMount(args *argContainer) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
// Preallocation on Btrfs is broken ( https://github.com/rfjakob/gocryptfs/issues/395 )
|
||||
// and slow ( https://github.com/rfjakob/gocryptfs/issues/63 ).
|
||||
if !args.noprealloc {
|
||||
var st unix.Statfs_t
|
||||
err = unix.Statfs(args.cipherdir, &st)
|
||||
if err == nil && st.Type == unix.BTRFS_SUPER_MAGIC {
|
||||
tlog.Info.Printf(tlog.ColorYellow +
|
||||
"Btrfs detected, forcing -noprealloc. See https://github.com/rfjakob/gocryptfs/issues/395 for why." +
|
||||
tlog.ColorReset)
|
||||
args.noprealloc = true
|
||||
}
|
||||
}
|
||||
// We cannot use JSON for pretty-printing as the fields are unexported
|
||||
tlog.Debug.Printf("cli args: %#v", args)
|
||||
// Initialize gocryptfs (read config file, ask for password, ...)
|
||||
|
Loading…
Reference in New Issue
Block a user