restorer: pre-allocate files before loading chunks

This commit is contained in:
Michael Eischer
2020-08-15 17:45:05 +02:00
parent 2e7d475029
commit 8cc9514879
8 changed files with 92 additions and 10 deletions

View File

@@ -0,0 +1,11 @@
// +build !linux,!darwin
package restorer
import "os"
func preallocateFile(wr *os.File, size int64) error {
// Maybe truncate can help?
// Windows: This calls SetEndOfFile which preallocates space on disk
return wr.Truncate(size)
}