aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Joseph Dodge <joseph.dodge@veritas.com>2017-08-24 14:37:10 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-24 15:17:01 +0200
commitf12d9686d4d673e59b8f561c49996820763220b1 (patch)
treea06f9f3941f2abe727eb06f5ff1ec70972498208 /include
parentfc83143867a37e34a51ce5a6d763b46715abf02d (diff)
Add idle_threads mount option.
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h10
-rw-r--r--include/fuse_common.h24
-rw-r--r--include/fuse_lowlevel.h11
3 files changed, 38 insertions, 7 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 4898029..4816617 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -964,13 +964,17 @@ void fuse_exit(struct fuse *f);
* in the callback function of fuse_operations is also thread-safe.
*
* @param f the FUSE handle
- * @param clone_fd whether to use separate device fds for each thread
- * (may increase performance)
+ * @param config loop configuration
* @return see fuse_session_loop()
*
* See also: fuse_loop()
*/
-int fuse_loop_mt(struct fuse *f, int clone_fd);
+#if FUSE_USE_VERSION < 32
+int fuse_loop_mt_31(struct fuse *f, int clone_fd);
+#define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
+#else
+int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
+#endif
/**
* Get the current context
diff --git a/include/fuse_common.h b/include/fuse_common.h
index ecaa906..ff78cc9 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -22,7 +22,7 @@
#define FUSE_MAJOR_VERSION 3
/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 1
+#define FUSE_MINOR_VERSION 2
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
@@ -79,7 +79,29 @@ struct fuse_file_info {
uint32_t poll_events;
};
+/**
+ * Configuration parameters passed to fuse_session_loop_mt() and
+ * fuse_loop_mt().
+ */
+struct fuse_loop_config {
+ /**
+ * whether to use separate device fds for each thread
+ * (may increase performance)
+ */
+ int clone_fd;
+ /**
+ * The maximum number of available worker threads before they
+ * start to get deleted when they become idle. If not
+ * specified, the default is 10.
+ *
+ * Adjusting this has performance implications; a very small number
+ * of threads in the pool will cause a lot of thread creation and
+ * deletion overhead and performance may suffer. When set to 0, a new
+ * thread will be created to service every operation.
+ */
+ unsigned int max_idle_threads;
+};
/**************************************************************************
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index ebfc626..72942ab 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -1760,6 +1760,7 @@ struct fuse_cmdline_opts {
int show_version;
int show_help;
int clone_fd;
+ unsigned int max_idle_threads;
};
/**
@@ -1857,11 +1858,15 @@ int fuse_session_loop(struct fuse_session *se);
* fuse_session_loop().
*
* @param se the session
- * @param clone_fd whether to use separate device fds for each thread
- * (may increase performance)
+ * @param config session loop configuration
* @return see fuse_session_loop()
*/
-int fuse_session_loop_mt(struct fuse_session *se, int clone_fd);
+#if FUSE_USE_VERSION < 32
+int fuse_session_loop_mt_31(struct fuse_session *se, int clone_fd);
+#define fuse_session_loop_mt(se, clone_fd) fuse_session_loop_mt_31(se, clone_fd)
+#else
+int fuse_session_loop_mt(struct fuse_session *se, struct fuse_loop_config *config);
+#endif
/**
* Flag a session as terminated.