Skip to content

Commit fabf7e0

Browse files
chadaustinMiklos Szeredi
authored andcommitted
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>
1 parent d9a9ea9 commit fabf7e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/fuse/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
124124
return -ENOMEM;
125125

126126
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);
128129
if (isdir ? !fc->no_opendir : !fc->no_open) {
129130
struct fuse_open_out outarg;
130131
int err;

0 commit comments

Comments
 (0)