summaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/mount.go b/mount.go
index 6c94240..8163df0 100644
--- a/mount.go
+++ b/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, ...)