From 9dbbe0e250a6f1b61d0dd8aa73288260a2a4ddb6 Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Sat, 2 Sep 2017 19:42:43 -0700 Subject: gfproxy: Make io-stats aware of the gfproxy daemon Summary: - This diff enables gfproxyd to output a stats file that looks like 'glusterfs_gfproxyd_{volname}.dump' - This is a port of D3753684 to 3.8 Test Plan: Tested on devserver, verified output. Reviewers: kvigor Reviewed By: kvigor Change-Id: I8559974e9d24976fd1c8b6145fbc81be40fd4134 Reviewed-on: https://review.gluster.org/18189 Reviewed-by: Shreyas Siravara CentOS-regression: Gluster Build System Smoke: Gluster Build System --- xlators/debug/io-stats/src/io-stats.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'xlators/debug') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index c710b59a520..2f9a2d92f15 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -151,6 +151,7 @@ struct ios_conf { struct dnscache *dnscache; int32_t ios_dnscache_ttl_sec; gf_boolean_t iamnfsd; + gf_boolean_t iamgfproxyd; }; @@ -782,6 +783,7 @@ _io_stats_get_key_prefix (xlator_t *this, char **key_prefix) { int bytes_written = 0; int i = 0; int ret = 0; + struct ios_conf *conf = this->private; xlator_name = strdupa (this->name); for (i = 0; i < strlen (xlator_name); i++) { @@ -797,6 +799,9 @@ _io_stats_get_key_prefix (xlator_t *this, char **key_prefix) { xlator_name = "nfsd"; if (this->prev->instance_name) instance_name = strdupa (this->prev->instance_name); + } else if (conf->iamgfproxyd) { + xlator_name = "gfproxyd"; + instance_name = this->name; } if (strcmp (__progname, "glusterfsd") == 0) @@ -3314,6 +3319,9 @@ _ios_dump_thread (xlator_t *this) { strcmp (this->prev->name, "nfs-server") == 0) { xlator_name = "nfsd"; instance_name = this->prev->instance_name; + } else if (conf->iamgfproxyd == _gf_true) { + xlator_name = "gfproxyd"; + instance_name = strdupa (this->name); } if (sys_mkdir (_IOS_DUMP_DIR, S_IRWXU | S_IRWXO | S_IRWXG) == (-1)) { if (errno != EEXIST) { @@ -4079,6 +4087,8 @@ init (xlator_t *this) GF_OPTION_INIT ("iam-nfs-daemon", conf->iamnfsd, bool, out); + GF_OPTION_INIT ("iam-gfproxy-daemon", conf->iamgfproxyd, bool, out); + GF_OPTION_INIT ("dump-fd-stats", conf->dump_fd_stats, bool, out); GF_OPTION_INIT ("count-fop-hits", conf->count_fop_hits, bool, out); @@ -4505,6 +4515,13 @@ struct volume_options options[] = { "translator is running as part of an NFS daemon " "or not." }, + { .key = {"iam-gfproxy-daemon"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "This option differentiates if the io-stats " + "translator is running as part of an GFProxy daemon " + "or not." + }, { .key = {NULL} }, }; -- cgit