summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/globals.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-09-18 23:03:32 +0530
committerAmar Tumballi <amarts@redhat.com>2017-11-03 14:40:52 +0530
commitbf5c5841c443a8da5b8f73c27b2ed83420f2303e (patch)
tree2006ede8204f8b27b46765840c08e395d79d05e9 /libglusterfs/src/globals.c
parentcf62283467d7dd30b89b80717f1fbc24670cb44b (diff)
global options: add a sample option to handle
Fixes #303 Change-Id: Icdaa804711c43c65b9684f2649437aae1b5c1ed5 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src/globals.c')
-rw-r--r--libglusterfs/src/globals.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index a43b80aa060..f182b1c7208 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -144,8 +144,20 @@ static struct xlator_fops global_fops = {
static int
global_xl_reconfigure (xlator_t *this, dict_t *options)
{
+ int ret = -1;
+ gf_boolean_t bool_opt = _gf_false;
+
+ /* This is not added in volume dump, hence adding the options in log
+ would be helpful for debugging later */
dict_dump_to_log (options);
- return 0;
+
+ GF_OPTION_RECONF ("measure-latency", bool_opt, options, bool, out);
+ this->ctx->measure_latency = bool_opt;
+
+ /* TODO: add more things here */
+ ret = 0;
+out:
+ return ret;
}
static int
@@ -160,11 +172,25 @@ global_xl_fini (xlator_t *this)
return;
}
+struct volume_options global_xl_options[] = {
+ { .key = {"measure-latency"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "no",
+ .op_version = {GD_OP_VERSION_4_0_0},
+ .flags = OPT_FLAG_SETTABLE,
+ .tags = {"global", "context"},
+ .description = "Use this option to toggle measuring latency"
+ },
+
+ { .key = {NULL},},
+};
+
+static volume_opt_list_t global_xl_opt_list;
+
int
glusterfs_this_init ()
{
- int ret = 0;
-
+ int ret = 0;
ret = pthread_key_create (&this_xlator_key, glusterfs_this_destroy);
if (ret != 0) {
gf_msg ("", GF_LOG_WARNING, ret,
@@ -182,6 +208,10 @@ glusterfs_this_init ()
global_xlator.fini = global_xl_fini;
INIT_LIST_HEAD (&global_xlator.volume_options);
+ INIT_LIST_HEAD (&global_xl_opt_list.list);
+ global_xl_opt_list.given_opt = global_xl_options;
+
+ list_add_tail (&global_xl_opt_list.list, &global_xlator.volume_options);
return ret;
}