diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2017-09-07 18:48:34 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-09-24 06:22:07 +0000 |
commit | 956d43d6e89d40ee683547003b876f1f456f03b6 (patch) | |
tree | 55a2289be12d67edba0e6a3b4d9b7341ce46532a | |
parent | f449e53df7c07301b495b4ff688d165026dfd2d0 (diff) | |
download | glusterfs-956d43d6e89d40ee683547003b876f1f456f03b6.tar.gz glusterfs-956d43d6e89d40ee683547003b876f1f456f03b6.tar.xz glusterfs-956d43d6e89d40ee683547003b876f1f456f03b6.zip |
mount/fuse: Make event-history feature configurable
... and disable it by default.
This is because having it disabled seems to improve performance.
This could be due to the lock contention by the different epoll threads
on the circular buff lock in the fop cbks just before writing their response
to /dev/fuse.
Just to provide some data - wrt ovirt-gluster hyperconverged
environment, I saw an increase in IOPs by 12K with event-history
disabled for randrom read workload.
Usage:
mount -t glusterfs -o event-history=on $HOSTNAME:$VOLNAME $MOUNTPOINT
OR
glusterfs --event-history=on --volfile-server=$HOSTNAME --volfile-id=$VOLNAME $MOUNTPOINT
Change-Id: Ia533788d309c78688a315dc8cd04d30fad9e9485
BUG: 1467614
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 28 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
-rwxr-xr-x | tests/bugs/fuse/bug-858215.t | 2 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 34 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 15 | ||||
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 7 |
7 files changed, 73 insertions, 15 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 31a9bf7168..76e57d9c16 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -246,6 +246,8 @@ static struct argp_option gf_options[] = { "Enable localtime logging"}, {"process-name", ARGP_PROCESS_NAME_KEY, "PROCESS-NAME", OPTION_HIDDEN, "option to specify the process type" }, + {"event-history", ARGP_FUSE_EVENT_HISTORY_KEY, "BOOL", + OPTION_ARG_OPTIONAL, "disable/enable fuse event-history"}, {0, 0, 0, 0, "Miscellaneous Options:"}, {0, } }; @@ -556,6 +558,15 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options) goto err; } } + if (cmd_args->event_history) { + ret = dict_set_str (options, "event-history", + cmd_args->event_history); + if (ret < 0) { + gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4, + "event-history"); + goto err; + } + } ret = 0; err: return ret; @@ -1292,6 +1303,23 @@ no_oom_api: } cmd_args->subdir_mount = gf_strdup (arg); break; + case ARGP_FUSE_EVENT_HISTORY_KEY: + if (!arg) + arg = "no"; + + if (gf_string2boolean (arg, &b) == 0) { + if (b) { + cmd_args->event_history = "yes"; + } else { + cmd_args->event_history = "no"; + } + + break; + } + + argp_failure (state, -1, 0, + "unknown event-history setting \"%s\"", arg); + break; } return 0; diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 99d9ec4e25..058a43fd38 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -99,6 +99,7 @@ enum argp_option_keys { ARGP_LOCALTIME_LOGGING_KEY = 177, ARGP_SUBDIR_MOUNT_KEY = 178, ARGP_PROCESS_NAME_KEY = 179, + ARGP_FUSE_EVENT_HISTORY_KEY = 180, }; struct _gfd_vol_top_priv { diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 37ce5d91a1..045f631f40 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -423,6 +423,7 @@ struct _cmd_args { char *subdir_mount; char *process_name; + char *event_history; }; typedef struct _cmd_args cmd_args_t; diff --git a/tests/bugs/fuse/bug-858215.t b/tests/bugs/fuse/bug-858215.t index 389783be84..acfaca9bb4 100755 --- a/tests/bugs/fuse/bug-858215.t +++ b/tests/bugs/fuse/bug-858215.t @@ -32,7 +32,7 @@ TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; ## Mount FUSE with caching disabled -TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --event-history=on -s $H0 --volfile-id $V0 $M0; ## Test for checking whether the fops have been saved in the event-history TEST ! stat $M0/newfile; diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 3b9824e137..34a0dbbe53 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -5161,10 +5161,15 @@ fuse_priv_dump (xlator_t *this) int fuse_history_dump (xlator_t *this) { - int ret = -1; - char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0,}; + int ret = -1; + char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0,}; + fuse_private_t *priv = this->private; GF_VALIDATE_OR_GOTO ("fuse", this, out); + + if (!priv->event_history) + goto out; + GF_VALIDATE_OR_GOTO (this->name, this->history, out); gf_proc_dump_build_key (key_prefix, "xlator.mount.fuse", @@ -5659,6 +5664,9 @@ init (xlator_t *this_xl) } } + GF_OPTION_INIT("event-history", priv->event_history, bool, + cleanup_exit); + /* user has set only background-qlen, not congestion-threshold, use the fuse kernel driver formula to set congestion. ie, 75% */ if (dict_get (this_xl->options, "background-qlen") && @@ -5757,14 +5765,16 @@ init (xlator_t *this_xl) goto cleanup_exit; } - event = eh_new (FUSE_EVENT_HISTORY_SIZE, _gf_false, NULL); - if (!event) { - gf_log (this_xl->name, GF_LOG_ERROR, - "could not create a new event history"); - goto cleanup_exit; - } + if (priv->event_history) { + event = eh_new (FUSE_EVENT_HISTORY_SIZE, _gf_false, NULL); + if (!event) { + gf_log (this_xl->name, GF_LOG_ERROR, + "could not create a new event history"); + goto cleanup_exit; + } - this_xl->history = event; + this_xl->history = event; + } pthread_mutex_init (&priv->fuse_dump_mutex, NULL); pthread_cond_init (&priv->sync_cond, NULL); @@ -5961,5 +5971,11 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_BOOL, .default_value = "false" }, + { .key = {"event-history"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "false", + .description = "This option can be used to enable or disable fuse " + "event history.", + }, { .key = {NULL} }, }; diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index 201b7f6930..2dfef64c97 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -135,6 +135,9 @@ struct fuse_private { /* Enable or disable capability support */ gf_boolean_t capability; + /* Enable or disable event history */ + gf_boolean_t event_history; + /* whether to run the unmount daemon */ gf_boolean_t auto_unmount; }; @@ -280,7 +283,8 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t; #define fuse_log_eh_fop(this, state, frame, op_ret, op_errno) \ do { \ - if (this->history) { \ + fuse_private_t *priv = this->private; \ + if (this->history && priv->event_history) { \ if (state->fd) \ gf_log_eh ("op_ret: %d, op_errno: %d, " \ "%"PRIu64", %s () => %p, gfid: %s", \ @@ -300,10 +304,11 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t; } \ } while(0) -#define fuse_log_eh(this, args...) \ - do { \ - if (this->history) \ - gf_log_eh(args); \ +#define fuse_log_eh(this, args...) \ + do { \ + fuse_private_t *priv = this->private; \ + if (this->history && priv->event_history) \ + gf_log_eh(args); \ } while (0) static inline xlator_t * diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index ea7205b95e..c6f2dda8e9 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -217,6 +217,10 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --use-readdirp=$use_readdirp"); fi + if [ -n "$event_history" ]; then + cmd_line=$(echo "$cmd_line --event-history=$event_history"); + fi + if [ -n "$volume_name" ]; then cmd_line=$(echo "$cmd_line --volume-name=$volume_name"); fi @@ -488,6 +492,9 @@ with_options() "use-readdirp") use_readdirp=$value ;; + "event-history") + event_history=$value + ;; "no-root-squash") if [ $value = "yes" ] || [ $value = "on" ] || |