summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats/src/io-stats.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-12-02 15:35:09 +0530
committerAmar Tumballi <amarts@redhat.com>2018-12-17 17:19:00 +0000
commitc228f0c2d94c028619088c07b66f88488f7c3335 (patch)
treec312f100b984ae36ec2d4e865194743a47f44769 /xlators/debug/io-stats/src/io-stats.c
parentbdcb2d8497d77ff28cb031ae3992eb7ea0c90486 (diff)
Don't depend on string options to be valid always
updates bz#1650403 Change-Id: Ib5a11e691599ce4bd93c1ed5aca6060592893961 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/debug/io-stats/src/io-stats.c')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index f40b00bba2d..f12191fb8df 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -173,7 +173,6 @@ struct ios_conf {
*/
char *unique_id;
ios_dump_type_t dump_format;
- char *dump_format_str;
};
struct ios_fd {
@@ -3680,15 +3679,15 @@ io_priv(xlator_t *this)
}
static void
-ios_set_log_format_code(struct ios_conf *conf)
+ios_set_log_format_code(struct ios_conf *conf, char *dump_format_str)
{
- if (strcmp(conf->dump_format_str, "json") == 0)
+ if (strcmp(dump_format_str, "json") == 0)
conf->dump_format = IOS_DUMP_TYPE_JSON_FILE;
- else if (strcmp(conf->dump_format_str, "text") == 0)
+ else if (strcmp(dump_format_str, "text") == 0)
conf->dump_format = IOS_DUMP_TYPE_FILE;
- else if (strcmp(conf->dump_format_str, "dict") == 0)
+ else if (strcmp(dump_format_str, "dict") == 0)
conf->dump_format = IOS_DUMP_TYPE_DICT;
- else if (strcmp(conf->dump_format_str, "samples") == 0)
+ else if (strcmp(dump_format_str, "samples") == 0)
conf->dump_format = IOS_DUMP_TYPE_SAMPLES;
}
@@ -3729,6 +3728,7 @@ reconfigure(xlator_t *this, dict_t *options)
char *sys_log_str = NULL;
char *log_format_str = NULL;
char *logger_str = NULL;
+ char *dump_format_str = NULL;
int sys_log_level = -1;
char *log_str = NULL;
int log_level = -1;
@@ -3773,9 +3773,8 @@ reconfigure(xlator_t *this, dict_t *options)
GF_OPTION_RECONF("ios-sample-interval", conf->ios_sample_interval, options,
int32, out);
- GF_OPTION_RECONF("ios-dump-format", conf->dump_format_str, options, str,
- out);
- ios_set_log_format_code(conf);
+ GF_OPTION_RECONF("ios-dump-format", dump_format_str, options, str, out);
+ ios_set_log_format_code(conf, dump_format_str);
GF_OPTION_RECONF("ios-sample-buf-size", conf->ios_sample_buf_size, options,
int32, out);
GF_OPTION_RECONF("sys-log-level", sys_log_str, options, str, out);
@@ -3880,6 +3879,7 @@ init(xlator_t *this)
char *sys_log_str = NULL;
char *logger_str = NULL;
char *log_format_str = NULL;
+ char *dump_format_str = NULL;
int logger = -1;
int log_format = -1;
int sys_log_level = -1;
@@ -3940,8 +3940,8 @@ init(xlator_t *this)
GF_OPTION_INIT("ios-sample-interval", conf->ios_sample_interval, int32,
out);
- GF_OPTION_INIT("ios-dump-format", conf->dump_format_str, str, out);
- ios_set_log_format_code(conf);
+ GF_OPTION_INIT("ios-dump-format", dump_format_str, str, out);
+ ios_set_log_format_code(conf, dump_format_str);
GF_OPTION_INIT("ios-sample-buf-size", conf->ios_sample_buf_size, int32,
out);