mirror of
https://github.com/rclone/rclone.git
synced 2026-01-01 08:03:26 +00:00
lib/file: don't run preallocate concurrently
This seems to cause file systems to get the amount of free space wrong.
This commit is contained in:
@@ -4,6 +4,7 @@ package file
|
||||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
@@ -15,6 +16,7 @@ var (
|
||||
ntdll = windows.NewLazySystemDLL("ntdll.dll")
|
||||
ntQueryVolumeInformationFile = ntdll.NewProc("NtQueryVolumeInformationFile")
|
||||
ntSetInformationFile = ntdll.NewProc("NtSetInformationFile")
|
||||
preAllocateMu sync.Mutex
|
||||
)
|
||||
|
||||
type fileAllocationInformation struct {
|
||||
@@ -42,6 +44,9 @@ func PreAllocate(size int64, out *os.File) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
preAllocateMu.Lock()
|
||||
defer preAllocateMu.Unlock()
|
||||
|
||||
var (
|
||||
iosb ioStatusBlock
|
||||
fsSizeInfo fileFsSizeInformation
|
||||
|
||||
Reference in New Issue
Block a user