summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/src/glfs.c2
-rw-r--r--cli/src/cli.c2
-rw-r--r--glusterfsd/src/glusterfsd.c4
-rw-r--r--libglusterfs/src/mem-pool.c13
4 files changed, 8 insertions, 13 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 7be675da3b7..705702d0da0 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -368,7 +368,9 @@ glfs_new (const char *volname)
return NULL;
}
+#ifdef DEBUG
gf_mem_acct_enable_set (ctx);
+#endif
/* first globals init, for gf_mem_acct_enable_set () */
ret = glusterfs_globals_init (ctx);
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 082ba67c0e2..37015c33d35 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -572,7 +572,9 @@ main (int argc, char *argv[])
if (!ctx)
return ENOMEM;
+#ifdef DEBUG
gf_mem_acct_enable_set (ctx);
+#endif
ret = glusterfs_globals_init (ctx);
if (ret)
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index cbb8c046bbd..28de24e8da6 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1839,9 +1839,9 @@ main (int argc, char *argv[])
}
glusterfsd_ctx = ctx;
+#ifdef DEBUG
gf_mem_acct_enable_set (ctx);
-
-#ifndef DEBUG
+#else
/* Enable memory accounting on the fly based on argument */
gf_check_and_set_mem_acct (ctx, argc, argv);
#endif
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 755e739449b..e35a599e679 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -33,22 +33,13 @@
void
gf_mem_acct_enable_set (void *data)
{
- char *opt = NULL;
- long val = -1;
glusterfs_ctx_t *ctx = NULL;
ctx = data;
- if (ctx->mem_acct_enable) {
- return;
- }
+ GF_ASSERT (ctx);
- opt = getenv (GLUSTERFS_ENV_MEM_ACCT_STR);
- if (opt) {
- val = strtol (opt, NULL, 0);
- if (val)
- ctx->mem_acct_enable = 1;
- }
+ ctx->mem_acct_enable = 1;
return;
}