On 8/12/21 8:09 PM, Jeffle Xu wrote:
From: Miklos Szeredi <mszeredi(a)redhat.com>
commit 6433b8998a21dc597002731c4ceb4144e856edc4 upstream
Add flag returned by OPENDIR request to allow kernel to cache directory
contents in page cache. The effect of FOPEN_CACHE_DIR is twofold:
a) if not already cached, it writes entries into the cache
b) if already cached, it allows reading entries from the cache
The FOPEN_KEEP_CACHE has the same effect as on regular files: unless this
flag is given the cache is cleared upon completion of open.
So FOPEN_KEEP_CACHE and FOPEN_KEEP_CACHE flags should be used together to
make use of the directory caching facility introduced in the following
patches.
The FUSE_AUTO_INVAL_DATA flag returned in INIT reply also has the same
affect on the directory cache as it has on data cache for regular files.
Signed-off-by: Miklos Szeredi <mszeredi(a)redhat.com>
Signed-off-by: Jeffle Xu <jefflexu(a)linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi(a)linux.alibaba.com>
---
include/uapi/linux/fuse.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 969dbd591e37..f008a61c5506 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -116,6 +116,9 @@
*
* 7.27
* - add FUSE_ABORT_ERROR
+ *
+ * 7.28
+ * - add FOPEN_CACHE_DIR
*/
#ifndef _LINUX_FUSE_H
@@ -219,11 +222,13 @@ struct fuse_file_lock {
* FOPEN_DIRECT_IO: bypass page cache for this open file
* FOPEN_KEEP_CACHE: don't invalidate the data cache on open
* FOPEN_NONSEEKABLE: the file is not seekable
+ * FOPEN_CACHE_DIR: allow caching this directory
* FOPEN_STREAM: the file is stream-like (no file position at all)
*/
#define FOPEN_DIRECT_IO (1 << 0)
#define FOPEN_KEEP_CACHE (1 << 1)
#define FOPEN_NONSEEKABLE (1 << 2)
+#define FOPEN_CACHE_DIR (1 << 3)
#define FOPEN_STREAM (1 << 4)
/**