diff options
author | Amar Tumballi <amar@gluster.com> | 2012-09-04 16:17:24 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-12-12 00:14:14 -0500 |
commit | 4f8dfaa90bddff3e0d094f292764f1d1690f6ec9 (patch) | |
tree | ac1ac7791e2aba58ff5eb9d3144daedaeeda0646 /xlators/mount | |
parent | ce192690231a573497f6934eea45602f0ff153d1 (diff) |
fuse: make background queue length configurable
* also make 'congestion_threshold' an option
* make 'congestion_threshold' as 75% of background queue length if
not explicitely specified
* in glusterfsd.c, moved all the fuse option dictionary setting
code to separate function
Change-Id: Ie1680eefaed9377720770a09222282321bd4132e
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 845214
Reviewed-on: https://code.engineering.redhat.com/gerrit/1860
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mount')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 42 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 4 | ||||
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 11 |
3 files changed, 54 insertions, 3 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 07859c60a4a..8b93a4d1fb0 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3389,8 +3389,8 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg) } if (fini->minor >= 13) { /* these values seemed to work fine during testing */ - fino.max_background = 64; - fino.congestion_threshold = 48; + fino.max_background = priv->background_qlen; + fino.congestion_threshold = priv->congestion_threshold; } if (fini->minor < 9) *priv->msg0_len_p = sizeof(*finh) + FUSE_COMPAT_WRITE_IN_SIZE; @@ -4574,6 +4574,32 @@ init (xlator_t *this_xl) goto cleanup_exit; } + /* default values seemed to work fine during testing */ + GF_OPTION_INIT ("background-qlen", priv->background_qlen, int32, + cleanup_exit); + GF_OPTION_INIT ("congestion-threshold", priv->congestion_threshold, + int32, cleanup_exit); + + if (dict_get (this_xl->options, "background-qlen") && + !dict_get (this_xl->options, "congestion-threshold")) { + /* user has set only background-qlen, not congestion-threshold, + use the fuse kernel driver formula to set congestion, + ie, 75% */ + priv->congestion_threshold = (priv->background_qlen * 3) / 4; + gf_log (this_xl->name, GF_LOG_INFO, + "setting congestion control as 75%% of " + "background-queue length (ie, (.75 * %d) = %d", + priv->background_qlen, priv->congestion_threshold); + } + /* congestion should not be higher than background queue length */ + if (priv->congestion_threshold > priv->background_qlen) { + gf_log (this_xl->name, GF_LOG_INFO, + "setting congestion control same as " + "background-queue length (%d)", + priv->background_qlen); + priv->congestion_threshold = priv->background_qlen; + } + cmd_args = &this_xl->ctx->cmd_args; fsname = cmd_args->volfile; if (!fsname && cmd_args->volfile_server) { @@ -4742,5 +4768,17 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_INT, .default_value = "0" }, + { .key = {"background-qlen"}, + .type = GF_OPTION_TYPE_INT, + .default_value = "64", + .min = 16, + .max = (64 * GF_UNIT_KB), + }, + { .key = {"congestion-threshold"}, + .type = GF_OPTION_TYPE_INT, + .default_value = "48", + .min = 12, + .max = (64 * GF_UNIT_KB), + }, { .key = {NULL} }, }; diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index f9d897c3037..d5b57e068df 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -122,6 +122,10 @@ struct fuse_private { /* For communicating with separate mount thread. */ int status_pipe[2]; + + /* for fuse queue length and congestion threshold */ + int background_qlen; + int congestion_threshold; }; typedef struct fuse_private fuse_private_t; diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index f3d3839e8fa..833013abc76 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -109,6 +109,14 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --gid-timeout=$gid_timeout"); fi + if [ -n "$bg_qlen" ]; then + cmd_line=$(echo "$cmd_line --background-qlen=$bg_qlen"); + fi + + if [ -n "$cong_threshold" ]; then + cmd_line=$(echo "$cmd_line --congestion-threshold=$cong_threshold"); + fi + if [ -z "$volfile_loc" ]; then if [ -n "$server_ip" ]; then if [ -n "$server_port" ]; then @@ -137,7 +145,6 @@ start_glusterfs () err=0; $cmd_line; - inode=$(stat -c %i $mount_point 2>/dev/null); # this is required if the stat returns error @@ -284,6 +291,8 @@ main () "backupvolfile-server") backupvolfile_server=$value ;; "gid-timeout") gid_timeout=$value ;; + "background-qlen") bg_qlen=$value ;; + "congestion-threshold") cong_threshold=$value ;; *) echo "unknown option $key (ignored)" ;; esac esac |