Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

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

Yves Gb1b5e0908106
diff --git a/vfs/vfs.go b/vfs/vfs.go
index 58e7630b1..ccd10265c 100644
--- a/vfs/vfs.go
+++ b/vfs/vfs.go
@@ -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
}