rclone/vfs/vfscache
Leo Luan 8f23cae1c0 vfs: Add cache reset for --vfs-cache-max-size handling at cache poll interval
The vfs-cache-max-size parameter is probably confusing to many users.
The cache cleaner checks cache size periodically at the --vfs-cache-poll-interval
(default 60 seconds) interval and remove cache items in the following order.

(1) cache items that are not in use and with age > vfs-cache-max-age
(2) if the cache space used at this time still is larger than
vfs-cache-max-size, the cleaner continues to remove cache items that are
not in use.

The cache cleaning process does not remove cache items that are currently in use.
If the total space consumed by in-use cache items exceeds vfs-cache-max-size, the
periodical cache cleaner thread does not do anything further and leaves the in-use
cache items alone with a total space larger than vfs-cache-max-size.

A cache reset feature was introduced in 1.53 which resets in-use (but not dirty,
i.e., not being updated) cache items when additional cache data incurs an ENOSPC
error.  But this code was not activated in the periodical cache cleaning thread.

This patch adds the cache reset step in the cache cleaner thread during cache
poll to reset cache items until the total size of the remaining cache items is
below vfs-cache-max-size.
2021-04-26 17:55:52 +01:00
..
downloaders vfs: fix file leaks with --vfs-cache-mode full and --buffer-size 0 2021-01-21 18:35:04 +00:00
writeback fs: deglobalise the config #4685 2020-11-26 16:40:12 +00:00
cache_test.go vfs: rename files in cache and cancel uploads on directory rename 2021-03-22 09:07:01 +00:00
cache.go vfs: Add cache reset for --vfs-cache-max-size handling at cache poll interval 2021-04-26 17:55:52 +01:00
item_test.go Spelling fixes 2020-10-14 15:21:31 +01:00
item.go vfs: fix a code path which allows dirty data to be removed causing data loss 2021-04-20 16:36:38 +01:00