aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--include/fuse_common.h12
-rw-r--r--include/fuse_kernel.h6
-rw-r--r--lib/fuse_lowlevel.c22
4 files changed, 44 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f7f9db2..1376e81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-23 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Make the number of max background requests and congestion
+ threshold tunable. New options are "max_background" and
+ "congestion_threshold". Only effective on linux kernel versions
+ 2.6.32 or greater. Patch by Csaba Henk
+
2010-06-17 Miklos Szeredi <miklos@szeredi.hu>
* Add fuse_reply_fd() reply function to the low level interface.
diff --git a/include/fuse_common.h b/include/fuse_common.h
index c547ac8..70304c3 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -160,9 +160,19 @@ struct fuse_conn_info {
unsigned want;
/**
+ * Maximum number of backgrounded requests
+ */
+ unsigned max_background;
+
+ /**
+ * Kernel congestion threshold parameter
+ */
+ unsigned congestion_threshold;
+
+ /**
* For future use.
*/
- unsigned reserved[25];
+ unsigned reserved[23];
};
struct fuse_session;
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index bd73630..6f9b9b5 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -66,6 +66,7 @@
#define __s64 int64_t
#define __u32 uint32_t
#define __s32 int32_t
+#define __u16 uint16_t
/*
* Version negotiation:
@@ -91,7 +92,7 @@
#define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 12
+#define FUSE_KERNEL_MINOR_VERSION 13
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
@@ -477,7 +478,8 @@ struct fuse_init_out {
__u32 minor;
__u32 max_readahead;
__u32 flags;
- __u32 unused;
+ __u16 max_background;
+ __u16 congestion_threshold;
__u32 max_write;
};
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 76eaa3f..109f92d 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1416,6 +1416,19 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.flags |= FUSE_DONT_MASK;
outarg.max_readahead = f->conn.max_readahead;
outarg.max_write = f->conn.max_write;
+ if (f->conn.proto_minor >= 13) {
+ if (f->conn.max_background >= (1 << 16))
+ f->conn.max_background = (1 << 16) - 1;
+ if (f->conn.congestion_threshold > f->conn.max_background)
+ f->conn.congestion_threshold = f->conn.max_background;
+ if (!f->conn.congestion_threshold) {
+ f->conn.congestion_threshold =
+ f->conn.max_background * 3 / 4;
+ }
+
+ outarg.max_background = f->conn.max_background;
+ outarg.congestion_threshold = f->conn.congestion_threshold;
+ }
if (f->debug) {
fprintf(stderr, " INIT: %u.%u\n", outarg.major, outarg.minor);
@@ -1423,6 +1436,10 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fprintf(stderr, " max_readahead=0x%08x\n",
outarg.max_readahead);
fprintf(stderr, " max_write=0x%08x\n", outarg.max_write);
+ fprintf(stderr, " max_background=%i\n",
+ outarg.max_background);
+ fprintf(stderr, " congestion_threshold=%i\n",
+ outarg.congestion_threshold);
}
send_reply_ok(req, &outarg, arg->minor < 5 ? 8 : sizeof(outarg));
@@ -1709,6 +1726,9 @@ static struct fuse_opt fuse_ll_opts[] = {
{ "allow_root", offsetof(struct fuse_ll, allow_root), 1 },
{ "max_write=%u", offsetof(struct fuse_ll, conn.max_write), 0 },
{ "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 },
+ { "max_background=%u", offsetof(struct fuse_ll, conn.max_background), 0 },
+ { "congestion_threshold=%u",
+ offsetof(struct fuse_ll, conn.congestion_threshold), 0 },
{ "async_read", offsetof(struct fuse_ll, conn.async_read), 1 },
{ "sync_read", offsetof(struct fuse_ll, conn.async_read), 0 },
{ "atomic_o_trunc", offsetof(struct fuse_ll, atomic_o_trunc), 1},
@@ -1735,6 +1755,8 @@ static void fuse_ll_help(void)
fprintf(stderr,
" -o max_write=N set maximum size of write requests\n"
" -o max_readahead=N set maximum readahead\n"
+" -o max_background=N set number of maximum background requests\n"
+" -o congestion_threshold=N set kernel's congestion threshold\n"
" -o async_read perform reads asynchronously (default)\n"
" -o sync_read perform reads synchronously\n"
" -o atomic_o_trunc enable atomic open+truncate support\n"