summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/xlator.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r--libglusterfs/src/xlator.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 4817da43da1..e371038f2c7 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -495,10 +495,22 @@ __xlator_init(xlator_t *xl)
{
xlator_t *old_THIS = NULL;
int ret = 0;
+ int fop_idx = 0;
old_THIS = THIS;
THIS = xl;
+ /* initialize the metrics related locks */
+ for (fop_idx = 0; fop_idx < GF_FOP_MAXVALUE; fop_idx++) {
+ GF_ATOMIC_INIT (xl->stats.total.metrics[fop_idx].fop, 0);
+ GF_ATOMIC_INIT (xl->stats.total.metrics[fop_idx].cbk, 0);
+
+ GF_ATOMIC_INIT (xl->stats.interval.metrics[fop_idx].fop, 0);
+ GF_ATOMIC_INIT (xl->stats.interval.metrics[fop_idx].cbk, 0);
+ }
+ GF_ATOMIC_INIT (xl->stats.total.count, 0);
+ GF_ATOMIC_INIT (xl->stats.interval.count, 0);
+
xlator_init_lock ();
ret = xl->init (xl);
xlator_init_unlock ();