summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2014-03-29 06:59:39 -0700
committerAnand Avati <avati@redhat.com>2014-05-05 17:28:29 -0700
commit7fba3a88f1ced610eca0c23516a1e720d75160cd (patch)
tree245bc7bda320b7894a0f7806087175faaf1bbce7
parent71ad38b3f86bdb0c4e9120b58ff451a6711ead9d (diff)
mem-accounting: enable memory accounting by default
memory accounting are constant time operations which involve a few pointer dereferences and integer increments (no loops or searches etc.) benefits of having memory usage info outweigh the minor accounting overheads Change-Id: If9bc6db5ffd0e00f0fd64b2f6eed094bf3543996 BUG: 1089216 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/7543 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
-rw-r--r--api/src/glfs.c4
-rw-r--r--glusterfsd/src/glusterfsd.c20
-rw-r--r--libglusterfs/src/ctx.c2
3 files changed, 3 insertions, 23 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index b69d785a8ab..cefbc645eb3 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -522,10 +522,6 @@ 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);
if (ret)
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index e971426da93..1163660a1a5 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -212,7 +212,7 @@ static struct argp_option gf_options[] = {
{"volfile-check", ARGP_VOLFILE_CHECK_KEY, 0, 0,
"Enable strict volume file checking"},
{"mem-accounting", ARGP_MEM_ACCOUNTING_KEY, 0, OPTION_HIDDEN,
- "Enable internal memory accounting"},
+ "Enable internal memory accounting (enabled by default, obsolete)"},
{"fuse-mountopts", ARGP_FUSE_MOUNTOPTS_KEY, "OPTIONS", OPTION_HIDDEN,
"Extra mount options to pass to FUSE"},
{"use-readdirp", ARGP_FUSE_USE_READDIRP_KEY, "BOOL", OPTION_ARG_OPTIONAL,
@@ -1478,17 +1478,6 @@ logging_init (glusterfs_ctx_t *ctx, const char *progpath)
return 0;
}
-void
-gf_check_and_set_mem_acct (glusterfs_ctx_t *ctx, int argc, char *argv[])
-{
- int i = 0;
- for (i = 0; i < argc; i++) {
- if (strcmp (argv[i], "--mem-accounting") == 0) {
- gf_mem_acct_enable_set (ctx);
- break;
- }
- }
-}
int
parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
@@ -1978,13 +1967,6 @@ main (int argc, char *argv[])
}
glusterfsd_ctx = ctx;
-#ifdef DEBUG
- gf_mem_acct_enable_set (ctx);
-#else
- /* Enable memory accounting on the fly based on argument */
- gf_check_and_set_mem_acct (ctx, argc, argv);
-#endif
-
ret = glusterfs_globals_init (ctx);
if (ret)
return ret;
diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c
index 0082601d466..f273451a74b 100644
--- a/libglusterfs/src/ctx.c
+++ b/libglusterfs/src/ctx.c
@@ -31,6 +31,8 @@ glusterfs_ctx_new ()
goto out;
}
+ ctx->mem_acct_enable = 1;
+
INIT_LIST_HEAD (&ctx->graphs);
INIT_LIST_HEAD (&ctx->mempool_list);