summaryrefslogtreecommitdiff
path: root/fs/fuse/inode.c
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2009-07-01 17:28:41 -0700
committerMiklos Szeredi <mszeredi@suse.cz>2009-07-07 17:28:52 +0200
commit7a6d3c8b3049d07123628f2bf57127bba2cc878f (patch)
treebfa09bd7e87753eb777699e0566e396ae639532c /fs/fuse/inode.c
parent8e4a718ff38d8539938ec3421935904c27e00c39 (diff)
downloadlinux-3.10-7a6d3c8b3049d07123628f2bf57127bba2cc878f.tar.gz
linux-3.10-7a6d3c8b3049d07123628f2bf57127bba2cc878f.tar.bz2
linux-3.10-7a6d3c8b3049d07123628f2bf57127bba2cc878f.zip
fuse: make the number of max background requests and congestion threshold tunable
The practical values for these limits depend on the design of the filesystem server so let userspace set them at initialization time. Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r--fs/fuse/inode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index f91ccc4a189..9aa6f46d0c3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -32,6 +32,12 @@ DEFINE_MUTEX(fuse_mutex);
#define FUSE_DEFAULT_BLKSIZE 512
+/** Maximum number of outstanding background requests */
+#define FUSE_DEFAULT_MAX_BACKGROUND 12
+
+/** Congestion starts at 75% of maximum */
+#define FUSE_DEFAULT_CONGESTION_THRESHOLD (FUSE_DEFAULT_MAX_BACKGROUND * 3 / 4)
+
struct fuse_mount_data {
int fd;
unsigned rootmode;
@@ -517,6 +523,8 @@ void fuse_conn_init(struct fuse_conn *fc)
INIT_LIST_HEAD(&fc->bg_queue);
INIT_LIST_HEAD(&fc->entry);
atomic_set(&fc->num_waiting, 0);
+ fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND;
+ fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD;
fc->khctr = 0;
fc->polled_files = RB_ROOT;
fc->reqctr = 0;
@@ -736,6 +744,12 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
else {
unsigned long ra_pages;
+ if (arg->minor >= 13) {
+ if (arg->max_background)
+ fc->max_background = arg->max_background;
+ if (arg->congestion_threshold)
+ fc->congestion_threshold = arg->congestion_threshold;
+ }
if (arg->minor >= 6) {
ra_pages = arg->max_readahead / PAGE_CACHE_SIZE;
if (arg->flags & FUSE_ASYNC_READ)