From 08fadcc2a706342e4eee79dc7d9b48ba01fcb312 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 9 Jan 2018 15:11:00 +0530 Subject: mount/fuse: Add support for multi-threaded fuse readers Usage: Use 'reader-thread-count=' as command line option to set the thread count at the time of mounting the volume. Next task is to make these threads auto-scale based on the load, instead of having the user remount the volume everytime to change the thread count. Updates #412 Change-Id: I94aa1505e5ae6a133683d473e0e4e0edd139b76b Signed-off-by: Krutika Dhananjay --- glusterfsd/src/glusterfsd.c | 26 ++++++++++++++++++++++++++ glusterfsd/src/glusterfsd.h | 1 + 2 files changed, 27 insertions(+) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index a113e3c479f..cb744f04fdf 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -247,6 +247,8 @@ static struct argp_option gf_options[] = { "option to specify the process type" }, {"event-history", ARGP_FUSE_EVENT_HISTORY_KEY, "BOOL", OPTION_ARG_OPTIONAL, "disable/enable fuse event-history"}, + {"reader-thread-count", ARGP_READER_THREAD_COUNT_KEY, "INTEGER", + OPTION_ARG_OPTIONAL, "set fuse reader thread count"}, {0, 0, 0, 0, "Miscellaneous Options:"}, {0, } }; @@ -598,6 +600,16 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) goto err; } } + if (cmd_args->reader_thread_count) { + ret = dict_set_uint32 (options, "reader-thread-count", + cmd_args->reader_thread_count); + if (ret < 0) { + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "failed to set dict value for key " + "reader-thread-count"); + goto err; + } + } ret = 0; err: @@ -1340,6 +1352,20 @@ no_oom_api: argp_failure (state, -1, 0, "unknown event-history setting \"%s\"", arg); break; + case ARGP_READER_THREAD_COUNT_KEY: + if (gf_string2uint32 (arg, &cmd_args->reader_thread_count)) { + argp_failure (state, -1, 0, + "unknown reader thread count option %s", + arg); + } else if ((cmd_args->reader_thread_count < 1) || + (cmd_args->reader_thread_count > 64)) { + argp_failure (state, -1, 0, + "Invalid reader thread count %s. " + "Valid range: [\"1, 64\"]", arg); + } + + break; + } return 0; } diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 4cbad534000..38785441817 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -101,6 +101,7 @@ enum argp_option_keys { ARGP_PROCESS_NAME_KEY = 179, ARGP_FUSE_EVENT_HISTORY_KEY = 180, ARGP_THIN_CLIENT_KEY = 181, + ARGP_READER_THREAD_COUNT_KEY = 182, }; struct _gfd_vol_top_priv { -- cgit