Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification about the caching in the README #85

Open
cesss opened this issue Jan 17, 2019 · 2 comments
Open

Clarification about the caching in the README #85

cesss opened this issue Jan 17, 2019 · 2 comments

Comments

@cesss
Copy link

cesss commented Jan 17, 2019

In the README it's said that "You get caching which speeds things up a lot for free". I'd like that sentence to be explained a bit deeper: Does it mean that the system can cache the contents of files read through unionfs-fuse? If affirmative, can that behaviour be disabled? (I'd like to modify the code of unionfs-fuse for a system where I'd like different processes to see different versions of the files, so if the OS will cache the contents of the files, I guess it will ruin my goal...)

@bsbernd
Copy link
Contributor

bsbernd commented Jan 17, 2019

There is a no caching in union-fuse itself, but at the same time fuse page cache is enabled by default - with current linking of unionfs-fuse to libfuse2, this can be disabled. I think this option is gone with libfuse3 and we probably need to add an option for it to unionfs-fuse itself, once we switch to libfuse3 (which we probably need to do soon)

@cesss
Copy link
Author

cesss commented Jan 17, 2019

Basically, the modified version that I'm planning to do would check the PID of the calling process before opening files. If such PID is not registered in a global index of "known PIDs", the union mount will look like empty to such process. If the PID is registered, then it will get files whose content comes from different source folders depending on the PID (ie: imagine process 720 gets the content of "/src_a/somefile.c" while process 724 gets the content of "/src_b/somefile.c"). So basically, different PIDs would get different union mounts, although they are mounted at the same mountpoint.

This means I'd need to disable kernel caching for the union mount, or otherwise I suppose the two processes in the example would get the same file if it's cached by the OS kernel (I plan to use it both on Mac and Linux, so I might need different ways for getting this lack-of-cache behavior in both OSs).

What functions in unionfs-fuse do you think are the best place for implementing this behavior? (note that this PID-dependent file contents are for a read-only scenario: in fact my processes are not going to write in the union mount)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants