rclone/vfs
Leo Luan c665201b85 vfs: support synchronous cache space recovery upon ENOSPC
This patch provides the support of synchronous cache space recovery
to allow read threads to recover from ENOSPC errors when cache space
can be recovered from cache items that are not in use or safe to be
reset/emptied .

The patch complements the existing cache cleaning process in two ways.

Firstly, the existing cache cleaning process is time-driven that runs
periodically. The cache space can run out while the cache cleaner
thread is still waiting for its next scheduled run. The io threads
encountering ENOSPC return an internal error to the applications
in this case even when cache space can be recovered to avoid this
error. This patch addresses this problem by having the read threads
kick the cache cleaner thread in this condition to recover cache
space preventing unnecessary ENOSPC errors from being seen by the
applications.

Secondly, this patch enhances the cache cleaner to support cache
item reset. Currently the cache purge process removes cache
items that are not in use. This may not be sufficient when the
total size of the working set exceeds the cache directory's
capacity. Like in the current code, this patch starts the purge
process by removing cache files that are not in use. Cache items
whose access times are older than vfs-cache-max-age are removed first.
After that, other not-in-use items are removed in LRU order until
vfs-cache-max-size is reached. If the vfs-cache-max-size (the quota)
is still not reached at this time, this patch adds a cache reset
step to reset/empty cache files that are still in use but not
dirtied.  This enables application processes to continue without
seeing an error even when the working set depletes the cache space
as long as there is not a large write working set hoarding the
entire cache space.

By design this patch does not add ENOSPC error recovery for write
IOs. Rclone does not empty a write cache item until the file data
is written back to the backend upon close. Allowing more cache
space to be consumed by dirty cache items when the cache space is
already running low would increase the risk of exhausting the cache
space in a way that the vfs mount becomes unreadable.
2020-08-25 21:12:06 +01:00
..
test_vfs lib/random: unify random string generation into random.String 2019-08-06 12:44:08 +01:00
vfscache vfs: support synchronous cache space recovery upon ENOSPC 2020-08-25 21:12:06 +01:00
vfscommon vfs: add --vfs-read-ahead parameter for use with --vfs-cache-mode full 2020-08-06 17:26:18 +01:00
vfsflags vfs: add --vfs-read-ahead parameter for use with --vfs-cache-mode full 2020-08-06 17:26:18 +01:00
vfstest mount: change interface of mount commands to take mount options 2020-07-24 10:48:51 +01:00
dir.go vfs: fix directory locking caused by slow directory listings 2020-07-18 09:08:18 +01:00
dir_handle.go vfs: factor duplicated Open code into vfs from mount/cmount 2017-11-03 13:00:00 +00:00
dir_handle_test.go vfs: add --vfs-writeback option to delay writes back to cloud storage 2020-06-30 12:01:36 +01:00
dir_test.go vfs: make dir.ForgetAll and friends not forget virtual entries 2020-06-30 12:03:39 +01:00
errors.go build: drop support for go1.8 2019-04-15 21:49:58 +01:00
errors_test.go vfs: add tests and subsequent fixes 2017-11-04 10:24:10 +00:00
file.go vfs: set the modtime of the cache file immediately 2020-08-20 16:24:04 +01:00
file_test.go vfs: fix rename tests by waiting for writes to complete 2020-08-19 17:04:17 +01:00
help.go vfs: add --vfs-read-ahead parameter for use with --vfs-cache-mode full 2020-08-06 17:26:18 +01:00
make_open_tests.go vfs: bring DO NOT EDIT comments in line with "go help generate" 2020-04-30 12:24:44 +01:00
open_test.go vfs: bring DO NOT EDIT comments in line with "go help generate" 2020-04-30 12:24:44 +01:00
rc.go vfs: add an optional fs parameter to vfs rc methods 2020-06-30 12:01:36 +01:00
rc_test.go vfs: add an optional fs parameter to vfs rc methods 2020-06-30 12:01:36 +01:00
read.go accounting: add context to Account and propagate changes #3257 2020-07-28 16:41:17 +01:00
read_test.go vfs: add --vfs-writeback option to delay writes back to cloud storage 2020-06-30 12:01:36 +01:00
read_write.go vfs: support synchronous cache space recovery upon ENOSPC 2020-08-25 21:12:06 +01:00
read_write_test.go vfs: Make tests run reliably 2020-06-30 12:01:36 +01:00
vfs.go vfs: recommend --vfs-cache-modes writes on backends which can't stream 2020-08-18 17:33:27 +01:00
vfs_case_test.go vfs: add --vfs-writeback option to delay writes back to cloud storage 2020-06-30 12:01:36 +01:00
vfs_test.go vfs: re-use existing VFS if possible 2020-06-30 12:01:36 +01:00
vfstest_test.go mount: change interface of mount commands to take mount options 2020-07-24 10:48:51 +01:00
vstate_string.go vfs: stop virtual directory entries dropping out of the directory cache 2020-06-30 12:03:39 +01:00
write.go vfs: fix saving from chrome without --vfs-cache-mode writes #4293 2020-07-28 17:18:31 +01:00
write_test.go vfs: add --vfs-writeback option to delay writes back to cloud storage 2020-06-30 12:01:36 +01:00