mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-10 18:24:44 +00:00
Don't verify free space for files when folder MinDiskFreePct==0 (fixes #2600)
This commit is contained in:
parent
2cdfa59fbe
commit
03935b2d64
@ -92,6 +92,7 @@ type rwFolder struct {
|
|||||||
sleep time.Duration
|
sleep time.Duration
|
||||||
pause time.Duration
|
pause time.Duration
|
||||||
allowSparse bool
|
allowSparse bool
|
||||||
|
checkFreeSpace bool
|
||||||
|
|
||||||
stop chan struct{}
|
stop chan struct{}
|
||||||
queue *jobQueue
|
queue *jobQueue
|
||||||
@ -127,6 +128,7 @@ func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFo
|
|||||||
order: cfg.Order,
|
order: cfg.Order,
|
||||||
maxConflicts: cfg.MaxConflicts,
|
maxConflicts: cfg.MaxConflicts,
|
||||||
allowSparse: !cfg.DisableSparseFiles,
|
allowSparse: !cfg.DisableSparseFiles,
|
||||||
|
checkFreeSpace: cfg.MinDiskFreePct != 0,
|
||||||
|
|
||||||
stop: make(chan struct{}),
|
stop: make(chan struct{}),
|
||||||
queue: newJobQueue(),
|
queue: newJobQueue(),
|
||||||
@ -967,11 +969,13 @@ func (p *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.checkFreeSpace {
|
||||||
if free, err := osutil.DiskFreeBytes(p.dir); err == nil && free < file.Size() {
|
if free, err := osutil.DiskFreeBytes(p.dir); err == nil && free < file.Size() {
|
||||||
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, p.folder, p.dir, file.Name, float64(free)/1024/1024, float64(file.Size())/1024/1024)
|
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, p.folder, p.dir, file.Name, float64(free)/1024/1024, float64(file.Size())/1024/1024)
|
||||||
p.newError(file.Name, errors.New("insufficient space"))
|
p.newError(file.Name, errors.New("insufficient space"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
events.Default.Log(events.ItemStarted, map[string]string{
|
events.Default.Log(events.ItemStarted, map[string]string{
|
||||||
"folder": p.folder,
|
"folder": p.folder,
|
||||||
|
Loading…
Reference in New Issue
Block a user