@@ -14,6 +14,15 @@ pub enum CachePolicy {
1414 /// the FUSE client (i.e., the file system does not have exclusive access to the directory).
1515 Never ,
1616
17+ /// This is almost same as Never, but it allows page cache of directories, dentries and attr
18+ /// cache in guest. In other words, it acts like cache=never for normal files, and like
19+ /// cache=always for directories, besides, metadata like dentries and attrs are kept as well.
20+ /// This policy can be used if:
21+ /// 1. the client wants to use Never policy but it's performance in I/O is not good enough
22+ /// 2. the file system has exclusive access to the directory
23+ /// 3. cache directory content and other fs metadata can make a difference on performance.
24+ Metadata ,
25+
1726 /// The client is free to choose when and how to cache file data. This is the default policy and
1827 /// uses close-to-open consistency as described in the enum documentation.
1928 #[ default]
@@ -32,6 +41,7 @@ impl FromStr for CachePolicy {
3241 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
3342 match s {
3443 "never" | "Never" | "NEVER" | "none" | "None" | "NONE" => Ok ( CachePolicy :: Never ) ,
44+ "metadata" => Ok ( CachePolicy :: Metadata ) ,
3545 "auto" | "Auto" | "AUTO" => Ok ( CachePolicy :: Auto ) ,
3646 "always" | "Always" | "ALWAYS" => Ok ( CachePolicy :: Always ) ,
3747 _ => Err ( "invalid cache policy" ) ,
0 commit comments