Truncate: Logging improvements, show number of blocks as float
This commit is contained in:
parent
b27edba2bb
commit
aa6fa7f3cf
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user