mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 06:07:44 +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