diff options
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 25 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 1 |
2 files changed, 25 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 57b3f0160..68c511621 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -185,6 +185,8 @@ static struct argp_option gf_options[] = { "Dump fuse traffic to PATH"}, {"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"}, {0, 0, 0, 0, "Miscellaneous Options:"}, {0, } }; @@ -501,6 +503,7 @@ out: static error_t parse_opts (int key, char *arg, struct argp_state *state) { + glusterfs_ctx_t *ctx = NULL; cmd_args_t *cmd_args = NULL; uint32_t n = 0; double d = 0.0; @@ -763,6 +766,12 @@ parse_opts (int key, char *arg, struct argp_state *state) argp_failure (state, -1, 0, "unknown brick (listen) port %s", arg); break; + + case ARGP_MEM_ACCOUNTING_KEY: + /* TODO: it should have got handled much earlier */ + ctx = glusterfs_ctx_get (); + ctx->mem_accounting = 1; + break; } return 0; @@ -1102,6 +1111,17 @@ logging_init (glusterfs_ctx_t *ctx) return 0; } +void +gf_check_and_set_mem_acct (int argc, char *argv[], glusterfs_ctx_t *ctx) +{ + int i = 0; + for (i = 0; i < argc; i++) { + if (strcmp (argv[i], "--mem-accounting") == 0) { + ctx->mem_accounting = 1; + break; + } + } +} int parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) @@ -1582,7 +1602,10 @@ main (int argc, char *argv[]) "ERROR: glusterfs context not initialized"); return ENOMEM; } - +#ifndef DEBUG + /* Enable memory accounting on the fly based on argument */ + gf_check_and_set_mem_acct (argc, argv, ctx); +#endif ret = glusterfs_ctx_defaults_init (ctx); if (ret) goto out; diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 3c38fbef0..06c23a342 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -80,6 +80,7 @@ enum argp_option_keys { ARGP_ACL_KEY = 154, ARGP_WORM_KEY = 155, ARGP_USER_MAP_ROOT_KEY = 156, + ARGP_MEM_ACCOUNTING_KEY = 157, }; struct _gfd_vol_top_priv_t { |