"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
vfs: fix excess CPU used by VFS cache cleaner looping
Nick Craig-Wood2a817e21cb3b
diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.goindex 8e5209a79..9c0ec0bf0 100644--- a/vfs/vfscache/cache.go+++ b/vfs/vfscache/cache.go@@ -739,27 +739,17 @@ func (c *Cache) clean(kicked bool) {oldItems, oldUsed := len(c.item), fs.SizeSuffix(c.used)c.mu.Unlock()- // loop cleaning the cache until we reach below cache quota- for {- // Remove any files that are over age- c.purgeOld(c.opt.CacheMaxAge)-- if int64(c.opt.CacheMaxSize) <= 0 {- break- }+ // Remove any files that are over age+ c.purgeOld(c.opt.CacheMaxAge)- // Now remove files not in use until cache size is below quota starting from the- // oldest first+ // If have a maximum cache size...+ if int64(c.opt.CacheMaxSize) > 0 {+ // Remove files not in use until cache size is below quota starting from the oldest firstc.purgeOverQuota(int64(c.opt.CacheMaxSize))// Remove cache files that are not dirty if we are still above the max cache sizec.purgeClean(int64(c.opt.CacheMaxSize))c.retryFailedResets()-- used := c.updateUsed()- if used <= int64(c.opt.CacheMaxSize) && len(c.errItems) == 0 {- break- }}// Was kicked?