diff options
author | Chad Austin <chadaustin@fb.com> | 2019-01-28 19:34:34 -0500 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-02-13 07:15:15 -0500 |
commit | fabf7e0262d0bd57739d29aeac94c44b0542ff1f (patch) | |
tree | 3aab55728f04c6b7fc6d0b36de30f8b6ccbe2acc | |
parent | d9a9ea94f748f47b1d75c6c5e33edcf74476c445 (diff) |
fuse: cache readdir calls if filesystem opts out of opendir
If a filesystem returns ENOSYS from opendir and thus opts out of
opendir and releasedir requests, it almost certainly would also like
readdir results cached. Default open_flags to FOPEN_KEEP_CACHE and
FOPEN_CACHE_DIR in that case.
With this patch, I've measured recursive directory enumeration across
large FUSE mounts to be faster than native mounts.
Signed-off-by: Chad Austin <chadaustin@fb.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/fuse/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index cc6ffd23b80f..06096b60f1df 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -124,7 +124,8 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, | |||
124 | return -ENOMEM; | 124 | return -ENOMEM; |
125 | 125 | ||
126 | ff->fh = 0; | 126 | ff->fh = 0; |
127 | ff->open_flags = FOPEN_KEEP_CACHE; /* Default for no-open */ | 127 | /* Default for no-open */ |
128 | ff->open_flags = FOPEN_KEEP_CACHE | (isdir ? FOPEN_CACHE_DIR : 0); | ||
128 | if (isdir ? !fc->no_opendir : !fc->no_open) { | 129 | if (isdir ? !fc->no_opendir : !fc->no_open) { |
129 | struct fuse_open_out outarg; | 130 | struct fuse_open_out outarg; |
130 | int err; | 131 | int err; |