feat: add virtiofs share cache policy option#487
Open
kajusnau wants to merge 1 commit intomicrovm-nix:mainfrom
Open
feat: add virtiofs share cache policy option#487kajusnau wants to merge 1 commit intomicrovm-nix:mainfrom
kajusnau wants to merge 1 commit intomicrovm-nix:mainfrom
Conversation
Signed-off-by: Kajus Naujokaitis <kajusn@gmail.com>
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a per-share virtiofs
cachepolicy option, which allows configuring the the caching policy that the file system should report to the FUSE client.Cache policy settings:
never- The client should never cache file data and all I/O should be directly forwarded to the server.This policy must be selected when file contents may change without the knowledge of the FUSE client (i.e., the file system does not have exclusive access to the directory)
metadata- This is almost same as Never, but it allows page cache of directories, dentries and attr cache in guest.In other words, it acts like
cache=neverfor normal files, and likecache=alwaysfor directories, besides, metadata like dentries and attrs are kept as well.This policy can be used if:
auto- Default.The client is free to choose when and how to cache file data.
By default the FUSE protocol uses close-to-open consistency. This means that any cached contents of the file are invalidated the next time that file is opened.
always- The client should always cache file data.This means that the FUSE client will not invalidate any cached data that was returned by the file system the last time the file was opened.
This policy should only be selected when the file system has exclusive access to the directory.
Virtiofs cache policy descriptions taken from here:
https://gitlab.com/virtio-fs/virtiofsd/-/blob/main/src/passthrough/mod.rs#L95
The default value remains
auto.Example configuration enabling forced cache for a typical
/nix/storeshare: