From 145b0f5a45c600c4f84f0d85adf36035a0abce5e Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Fri, 23 Dec 2011 11:49:02 +0530 Subject: debug/io-stats: Handle fini for io-stats xlator Signed-off-by: shishir gowda Change-Id: I0b36a2f4836fa84ced7414fdba4d68e0cb6cac7b BUG: 767862 Reviewed-on: http://review.gluster.com/2499 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/debug/io-stats/src/io-stats.c | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'xlators/debug/io-stats/src') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2786109b969..d216cc549ec 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2544,6 +2544,12 @@ void fini (xlator_t *this) { struct ios_conf *conf = NULL; + struct ios_stat_head *list_head = NULL; + struct ios_stat_list *entry = NULL; + struct ios_stat_list *tmp = NULL; + struct ios_stat_list *list = NULL; + struct ios_stat *stat = NULL; + int i = 0; if (!this) return; @@ -2554,7 +2560,38 @@ fini (xlator_t *this) return; this->private = NULL; - GF_FREE(conf); + for (i = 0; i < IOS_STATS_TYPE_MAX; i++) { + list_head = &conf->list[i]; + if (!list_head) + continue; + list_for_each_entry_safe (entry, tmp, + &list_head->iosstats->list, list) { + list = entry; + stat = list->iosstat; + ios_stat_unref (stat); + list_del (&list->list); + if (list) + GF_FREE (list); + } + } + + for (i = 0; i < IOS_STATS_THRU_MAX; i++) { + list_head = &conf->thru_list[i]; + if (!list_head) + continue; + list_for_each_entry_safe (entry, tmp, + &list_head->iosstats->list, list) { + list = entry; + stat = list->iosstat; + ios_stat_unref (stat); + list_del (&list->list); + if (list) + GF_FREE (list); + } + } + + if (conf) + GF_FREE(conf); gf_log (this->name, GF_LOG_INFO, "io-stats translator unloaded"); -- cgit