Commit 634734b63ac39e137a1c623ba74f3e062b6577db
Committed by
Miklos Szeredi
1 parent
7e98d53086
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
fuse: allow control of adaptive readdirplus use
For some filesystems (e.g. GlusterFS), the cost of performing a normal readdir and readdirplus are identical. Since adaptively using readdirplus has no benefit for those systems, give users/filesystems the option to control adaptive readdirplus use. v2 of this patch incorporates Miklos's suggestion to simplify the code, as well as improving consistency of macro names and documentation. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Showing 4 changed files with 12 additions and 2 deletions Side-by-side Diff
fs/fuse/dir.c
fs/fuse/fuse_i.h
... | ... | @@ -514,8 +514,11 @@ |
514 | 514 | /** Use enhanced/automatic page cache invalidation. */ |
515 | 515 | unsigned auto_inval_data:1; |
516 | 516 | |
517 | - /** Does the filesystem support readdir-plus? */ | |
517 | + /** Does the filesystem support readdirplus? */ | |
518 | 518 | unsigned do_readdirplus:1; |
519 | + | |
520 | + /** Does the filesystem want adaptive readdirplus? */ | |
521 | + unsigned readdirplus_auto:1; | |
519 | 522 | |
520 | 523 | /** The number of requests waiting for completion */ |
521 | 524 | atomic_t num_waiting; |
fs/fuse/inode.c
... | ... | @@ -866,6 +866,8 @@ |
866 | 866 | fc->auto_inval_data = 1; |
867 | 867 | if (arg->flags & FUSE_DO_READDIRPLUS) |
868 | 868 | fc->do_readdirplus = 1; |
869 | + if (arg->flags & FUSE_READDIRPLUS_AUTO) | |
870 | + fc->readdirplus_auto = 1; | |
869 | 871 | } else { |
870 | 872 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; |
871 | 873 | fc->no_lock = 1; |
... | ... | @@ -893,7 +895,7 @@ |
893 | 895 | FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | |
894 | 896 | FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | |
895 | 897 | FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | |
896 | - FUSE_DO_READDIRPLUS; | |
898 | + FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO; | |
897 | 899 | req->in.h.opcode = FUSE_INIT; |
898 | 900 | req->in.numargs = 1; |
899 | 901 | req->in.args[0].size = sizeof(*arg); |
include/uapi/linux/fuse.h
... | ... | @@ -218,6 +218,8 @@ |
218 | 218 | * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks |
219 | 219 | * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories |
220 | 220 | * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages |
221 | + * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) | |
222 | + * FUSE_READDIRPLUS_AUTO: adaptive readdirplus | |
221 | 223 | */ |
222 | 224 | #define FUSE_ASYNC_READ (1 << 0) |
223 | 225 | #define FUSE_POSIX_LOCKS (1 << 1) |
... | ... | @@ -233,6 +235,7 @@ |
233 | 235 | #define FUSE_HAS_IOCTL_DIR (1 << 11) |
234 | 236 | #define FUSE_AUTO_INVAL_DATA (1 << 12) |
235 | 237 | #define FUSE_DO_READDIRPLUS (1 << 13) |
238 | +#define FUSE_READDIRPLUS_AUTO (1 << 14) | |
236 | 239 | |
237 | 240 | /** |
238 | 241 | * CUSE INIT request/reply flags |