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:
parent
2b268f9724
commit
b1b5e09081
1 changed files with 9 additions and 0 deletions
|
@ -510,6 +510,15 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
|
|||
if u.Used != nil {
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue