From 60c6b1729b93c05614bdbb9e2e4594a94138fe6b Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Sun, 3 Sep 2017 10:31:47 -0700 Subject: debug/io-stats: Restrict io-thread queue depth stats to NFS Summary: - Fixes the unecessary log spew in other daemons - This is a port of D3646627 to 3.8 Reviewers: rwareing, kvigor Reviewed By: kvigor Change-Id: Id54ab41cdfdd2006d3af2d8774c38025c566c523 Reviewed-on: https://review.gluster.org/18199 Reviewed-by: Shreyas Siravara CentOS-regression: Gluster Build System Smoke: Gluster Build System --- tests/basic/stats-dump.t | 2 +- xlators/debug/io-stats/src/io-stats.c | 41 ++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/basic/stats-dump.t b/tests/basic/stats-dump.t index ceed7571a62..af1ad34702b 100644 --- a/tests/basic/stats-dump.t +++ b/tests/basic/stats-dump.t @@ -39,7 +39,7 @@ FUSE_RET="$?" # Test that io-stats is getting queue sizes from io-threads TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfs_nfsd_$V0.dump -TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump +TEST ! grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump TEST [ 0 -ne "$BRICK_RET" ] TEST [ 0 -ne "$NFSD_RET" ] diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 101803f470d..2835b0a3f6e 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1152,28 +1152,29 @@ io_stats_dump_global_to_json_logfp (xlator_t *this, "\"%s.%s.fop.unweighted_latency_ave_usec\":\"%0.4lf\",", key_prefix, str_prefix, fop_ave_usec); - dict_t *xattr = NULL; - ret = syncop_getxattr (this, &unused_loc, &xattr, - IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); - if (xattr) { - // Iterate over the dictionary returned to us by io-threads and - // dump the results to the stats file. - data_pair_t *curr = NULL; - dict_for_each (xattr, curr) { - ios_log (this, logfp, - "\"%s.%s.%s.queue_size\": \"%d\",", - key_prefix, str_prefix, curr->key, - data_to_int32 (curr->value)); - } + if (conf->iamnfsd) { + dict_t *xattr = NULL; + ret = syncop_getxattr (this, &unused_loc, &xattr, + IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); + if (xattr) { + // Iterate over the dictionary returned to us by io-threads and + // dump the results to the stats file. + data_pair_t *curr = NULL; + dict_for_each (xattr, curr) { + ios_log (this, logfp, + "\"%s.%s.%s.queue_size\": \"%d\",", + key_prefix, str_prefix, curr->key, + data_to_int32 (curr->value)); + } - // Free the dictionary - dict_unref (xattr); - } else { - gf_log (this->name, GF_LOG_WARNING, - "Unable to get queue size counts from " - "the io-threads translator!"); + // Free the dictionary + dict_unref (xattr); + } else { + gf_log (this->name, GF_LOG_WARNING, + "Unable to get queue size counts from " + "the io-threads translator!"); + } } - if (interval == -1) { ios_log (this, logfp, "\"%s.%s.uptime\": \"%"PRId64"\",", key_prefix, str_prefix, -- cgit