Better mechanism to handle memory accounting
Memory accounting will now be enabled if: 1) Any glusterfs process is spawned with argument --mem-accounting. 2) DEBUG is defined. Change-Id: I3345e114127a57ce61916be0e2c4e0049a4c3432 BUG: 834465 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4523 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
fcc230c99d
commit
fc501a57bc
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user