summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/mem-pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/mem-pool.c')
-rw-r--r--libglusterfs/src/mem-pool.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 0cfd8bd..7f20d6d 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -50,26 +50,31 @@ gf_mem_acct_is_enabled ()
void
gf_mem_acct_enable_set ()
{
- char *opt = NULL;
- long val = -1;
-
#ifdef DEBUG
gf_mem_acct_enable = 1;
return;
#endif
+ glusterfs_ctx_t *ctx = NULL;
+ char *opt = NULL;
+ long val = -1;
- opt = getenv (GLUSTERFS_ENV_MEM_ACCT_STR);
-
- if (!opt)
- return;
+ gf_mem_acct_enable = 0;
- val = strtol (opt, NULL, 0);
+ ctx = glusterfs_ctx_get ();
- if (val)
- gf_mem_acct_enable = 0;
- else
+ if (ctx->mem_accounting) {
gf_mem_acct_enable = 1;
+ return;
+ }
+ opt = getenv (GLUSTERFS_ENV_MEM_ACCT_STR);
+ if (opt) {
+ val = strtol (opt, NULL, 0);
+ if (val)
+ gf_mem_acct_enable = 1;
+ }
+
+ return;
}
void