vfs: make df output more consistent on a rclone mount.

When 2 values are known among vfs:{free,used,total}, compute the 3rd
This commit is contained in:
Yves G 2020-02-29 15:07:45 +01:00 committed by Nick Craig-Wood
parent 2b268f9724
commit b1b5e09081

View File

@ -510,6 +510,15 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
if u.Used != nil { if u.Used != nil {
used = *u.Used used = *u.Used
} }
if total < 0 && free >= 0 && used >= 0 {
total = free + used
}
if free < 0 && total >= 0 && used >= 0 {
free = total - used
}
if used < 0 && total >= 0 && free >= 0 {
used = total - free
}
} }
return return
} }