aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--include/uapi/linux/fuse.h3
4 files changed, 12 insertions, 2 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 2b112d978e9f..85065221a58a 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -21,6 +21,8 @@ static bool fuse_use_readdirplus(struct inode *dir, struct file *filp)
21 21
22 if (!fc->do_readdirplus) 22 if (!fc->do_readdirplus)
23 return false; 23 return false;
24 if (!fc->readdirplus_auto)
25 return true;
24 if (test_and_clear_bit(FUSE_I_ADVISE_RDPLUS, &fi->state)) 26 if (test_and_clear_bit(FUSE_I_ADVISE_RDPLUS, &fi->state))
25 return true; 27 return true;
26 if (filp->f_pos == 0) 28 if (filp->f_pos == 0)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index fc55dd33c1e2..6aeba864f070 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -514,9 +514,12 @@ struct fuse_conn {
514 /** Use enhanced/automatic page cache invalidation. */ 514 /** Use enhanced/automatic page cache invalidation. */
515 unsigned auto_inval_data:1; 515 unsigned auto_inval_data:1;
516 516
517 /** Does the filesystem support readdir-plus? */ 517 /** Does the filesystem support readdirplus? */
518 unsigned do_readdirplus:1; 518 unsigned do_readdirplus:1;
519 519
520 /** Does the filesystem want adaptive readdirplus? */
521 unsigned readdirplus_auto:1;
522
520 /** The number of requests waiting for completion */ 523 /** The number of requests waiting for completion */
521 atomic_t num_waiting; 524 atomic_t num_waiting;
522 525
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 9876a87255fe..01353ed75750 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -866,6 +866,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
866 fc->auto_inval_data = 1; 866 fc->auto_inval_data = 1;
867 if (arg->flags & FUSE_DO_READDIRPLUS) 867 if (arg->flags & FUSE_DO_READDIRPLUS)
868 fc->do_readdirplus = 1; 868 fc->do_readdirplus = 1;
869 if (arg->flags & FUSE_READDIRPLUS_AUTO)
870 fc->readdirplus_auto = 1;
869 } else { 871 } else {
870 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 872 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
871 fc->no_lock = 1; 873 fc->no_lock = 1;
@@ -893,7 +895,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
893 FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | 895 FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK |
894 FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | 896 FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ |
895 FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | 897 FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA |
896 FUSE_DO_READDIRPLUS; 898 FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO;
897 req->in.h.opcode = FUSE_INIT; 899 req->in.h.opcode = FUSE_INIT;
898 req->in.numargs = 1; 900 req->in.numargs = 1;
899 req->in.args[0].size = sizeof(*arg); 901 req->in.args[0].size = sizeof(*arg);
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index baee03e90438..4c43b4448792 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -218,6 +218,8 @@ struct fuse_file_lock {
218 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 218 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
219 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 219 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
220 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 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#define FUSE_ASYNC_READ (1 << 0) 224#define FUSE_ASYNC_READ (1 << 0)
223#define FUSE_POSIX_LOCKS (1 << 1) 225#define FUSE_POSIX_LOCKS (1 << 1)
@@ -233,6 +235,7 @@ struct fuse_file_lock {
233#define FUSE_HAS_IOCTL_DIR (1 << 11) 235#define FUSE_HAS_IOCTL_DIR (1 << 11)
234#define FUSE_AUTO_INVAL_DATA (1 << 12) 236#define FUSE_AUTO_INVAL_DATA (1 << 12)
235#define FUSE_DO_READDIRPLUS (1 << 13) 237#define FUSE_DO_READDIRPLUS (1 << 13)
238#define FUSE_READDIRPLUS_AUTO (1 << 14)
236 239
237/** 240/**
238 * CUSE INIT request/reply flags 241 * CUSE INIT request/reply flags