问题
It seems that the Linux VFS cache does not work by default with a FUSE filesystem. For example, the "read" call seems to be systematically forwarded to the FUSE filesystem.
I work on a FUSE specific remote filesystem. I need a very aggressive cache.
Do I need to implement my own page cache? Or is it possible to activate the Linux VFS cache for this particular FUSE filesystem? Or does someone know a good proxy/cache FUSE filesystem (or a kind of C library to do that without reinventing the wheel)?
Bonus question:
If I have to implement my own page cache, I think to use a REDIS daemon to do the LRU stuff. I'm nearly sure that it can be a good option for caching metadata. But for pages, I'm not sure that it will be better than a simple local directory (with VFS cache) or than /dev/shm. But I will lose LRU automatic cleaning. Does someone know a sort of /dev/shm with automatic LRU cleaning?
Some additional information: the filesystem is read-only and the remote side is nearly immutable; the remote side contains very big files that I can't copy to a local directory.
回答1:
I think VFS cache will not work on FUSE. There are caching solutions for FUSE or you can implement yours.
With a small search, I found fuse-cache; they claim that it is simple.
回答2:
You can use the FUSE auto_cache
option. FUSE will cache the data and only make several metadata calls to check if the file size or modification timestamp has changed.
来源:https://stackoverflow.com/questions/4557825/is-it-possible-to-have-a-linux-vfs-cache-with-a-fuse-filesystem