@@ -14,6 +14,15 @@ pub enum CachePolicy {
14
14
/// the FUSE client (i.e., the file system does not have exclusive access to the directory).
15
15
Never ,
16
16
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
+
17
26
/// The client is free to choose when and how to cache file data. This is the default policy and
18
27
/// uses close-to-open consistency as described in the enum documentation.
19
28
#[ default]
@@ -32,6 +41,7 @@ impl FromStr for CachePolicy {
32
41
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
33
42
match s {
34
43
"never" | "Never" | "NEVER" | "none" | "None" | "NONE" => Ok ( CachePolicy :: Never ) ,
44
+ "metadata" => Ok ( CachePolicy :: Metadata ) ,
35
45
"auto" | "Auto" | "AUTO" => Ok ( CachePolicy :: Auto ) ,
36
46
"always" | "Always" | "ALWAYS" => Ok ( CachePolicy :: Always ) ,
37
47
_ => Err ( "invalid cache policy" ) ,
0 commit comments