diff options
author | shishir gowda <shishirng@gluster.com> | 2011-12-23 11:49:02 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-12-28 22:21:19 -0800 |
commit | 145b0f5a45c600c4f84f0d85adf36035a0abce5e (patch) | |
tree | 315e397eef7c353f86a51aab8f9f5cdc0f7595e5 /xlators/debug/io-stats | |
parent | 1c4098a05e8e035c4e155aebb410fe2c811ccd50 (diff) |
debug/io-stats: Handle fini for io-stats xlator
Signed-off-by: shishir gowda <shishirng@gluster.com>
Change-Id: I0b36a2f4836fa84ced7414fdba4d68e0cb6cac7b
BUG: 767862
Reviewed-on: http://review.gluster.com/2499
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/debug/io-stats')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2786109b9..d216cc549 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"); |