mirror of
https://github.com/octoleo/restic.git
synced 2024-11-24 21:57:41 +00:00
Use PreallocateFile in local backend
This commit is contained in:
parent
ffc6b3d887
commit
c37d587f81
@ -148,6 +148,13 @@ func (b *Local) Save(_ context.Context, h restic.Handle, rd restic.RewindReader)
|
||||
}
|
||||
}(f)
|
||||
|
||||
// preallocate disk space
|
||||
if size := rd.Length(); size > 0 {
|
||||
if err := fs.PreallocateFile(f, size); err != nil {
|
||||
debug.Log("Failed to preallocate %v with size %v: %v", finalname, size, err)
|
||||
}
|
||||
}
|
||||
|
||||
// save data, then sync
|
||||
wbytes, err := io.Copy(f, rd)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user