summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/xlator.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-08-02 13:14:25 +0530
committerAnand Avati <avati@redhat.com>2012-08-03 02:01:52 -0700
commited4b76ba9c545f577287c0e70ae3cc853a0d5f3f (patch)
treedeffb91a0cee620ac7fcc8c7914dbca73668574e /libglusterfs/src/xlator.c
parent66205114267ec659b4ad8084c7e9497009529c61 (diff)
core: reduce the usage of global variables
* move all the 'logging' related global variables into ctx * make gf_fop_list a 'const' global array, hence no init(), no edits. * make sure ctx is allocated without any dependancy on memory-accounting infrastructure, so it can be the first one to get allocated * globals_init() should happen with ctx as argument not yet fixed below in this patchset: * anything with 'THIS' related globals * anything related to compat_errno related globals as its one time init'd and not changed later on. * statedump related globals Change-Id: Iab8fc30d4bfdbded6741d66ff1ed670fdc7b7ad2 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 764890 Reviewed-on: http://review.gluster.com/3767 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r--libglusterfs/src/xlator.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 7094f1ef5cf..6db27e9a4c4 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -460,12 +460,12 @@ xlator_mem_acct_init (xlator_t *xl, int num_types)
int i = 0;
int ret = 0;
- if (!gf_mem_acct_is_enabled ())
- return 0;
-
if (!xl)
return -1;
+ if (!xl->ctx->mem_acct_enable)
+ return 0;
+
xl->mem_acct.num_types = num_types;
xl->mem_acct.rec = CALLOC(num_types, sizeof(struct mem_acct_rec));