Doloops / mcachefs

mcachefs : Simple filesystem-based file cache based on fuse
64 stars 15 forks source link

updating previously cached files when they are updated in the backend. #25

Closed hradec closed 4 years ago

hradec commented 4 years ago

when re-mounting mcachefs with previously cached files, originally mcachefs_transfer_do_backing detects a file already in cache and would throw an error, forcing mcachefs to always use the source file instead of updating the local cache.

This change just reports that the already cached file exists and it's older than the source, and instead of returning and forcing mcachefs to use the source file, it will continue and update the file in the cache, so subsequent reading will be done from the cache as it should.

hradec commented 4 years ago

With this change, I can just re-mount to retrieve up-to-date files from the backend. Without this change, a re-mount would cause mcachefs to be extremely slow since all updated files in the backend would be transferred again on every read.

hradec commented 4 years ago

Ok, I just realized this change only works with my previous pull request #20 applied, which detects changes in file size between cached files and the up-to-date metadata (which holds the current file size of files in the backend after a re-mount).

So this pull request is part of #20 pull request.

hradec commented 4 years ago

as this one is part of pull request #20, I'm closing this one for now as well.