aboutsummaryrefslogtreecommitdiff
path: root/pathfs_frontend
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-04 15:43:46 +0200
committerJakob Unterwurzacher2015-10-04 15:45:46 +0200
commitaa6fa7f3cf0c7a2ab078ad4648eca742e5acd232 (patch)
tree6f55bbc7ff7eba2d0fbfc2916c6866ad81f23641 /pathfs_frontend
parentb27edba2bbf374b2e98d19d9fb3aa9f84721baf7 (diff)
Truncate: Logging improvements, show number of blocks as float
Diffstat (limited to 'pathfs_frontend')
-rw-r--r--pathfs_frontend/file.go6
-rw-r--r--pathfs_frontend/file_holes.go2
2 files changed, 5 insertions, 3 deletions
diff --git a/pathfs_frontend/file.go b/pathfs_frontend/file.go
index 47f935b..b328b61 100644
--- a/pathfs_frontend/file.go
+++ b/pathfs_frontend/file.go
@@ -241,9 +241,9 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
oldSize := f.cfs.PlainSize(uint64(fi.Size()))
{
- oldB := (oldSize + f.cfs.PlainBS() - 1) / f.cfs.PlainBS()
- newB := (newSize + f.cfs.PlainBS() - 1) / f.cfs.PlainBS()
- cryptfs.Debug.Printf("ino%d: truncate from %d to %d blocks (%d to %d bytes)\n", f.ino, oldB, newB, oldSize, newSize)
+ oldB := float32(oldSize) / float32(f.cfs.PlainBS())
+ newB := float32(newSize) / float32(f.cfs.PlainBS())
+ cryptfs.Debug.Printf("ino%d: FUSE Truncate from %.2f to %.2f blocks (%d to %d bytes)\n", f.ino, oldB, newB, oldSize, newSize)
}
// File grows
diff --git a/pathfs_frontend/file_holes.go b/pathfs_frontend/file_holes.go
index db27805..f906aa6 100644
--- a/pathfs_frontend/file_holes.go
+++ b/pathfs_frontend/file_holes.go
@@ -2,6 +2,7 @@ package pathfs_frontend
import (
"github.com/hanwen/go-fuse/fuse"
+ "github.com/rfjakob/gocryptfs/cryptfs"
)
// Will a write to offset "off" create a file hole?
@@ -19,6 +20,7 @@ func (f *file) zeroPad(plainSize uint64) fuse.Status {
lastBlockLen := plainSize % f.cfs.PlainBS()
missing := f.cfs.PlainBS() - lastBlockLen
pad := make([]byte, missing)
+ cryptfs.Debug.Printf("zeroPad: Writing %d bytes\n", missing)
_, status := f.doWrite(pad, int64(plainSize))
return status
}