summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/ctx.c3
-rw-r--r--libglusterfs/src/globals.c14
-rw-r--r--libglusterfs/src/globals.h3
-rw-r--r--libglusterfs/src/glusterfs.h1
4 files changed, 20 insertions, 1 deletions
diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c
index bc704aceacb..aa9d4216fd3 100644
--- a/libglusterfs/src/ctx.c
+++ b/libglusterfs/src/ctx.c
@@ -14,6 +14,7 @@
#endif /* !_CONFIG_H */
#include <pthread.h>
+#include "globals.h"
#include "glusterfs.h"
@@ -31,7 +32,7 @@ glusterfs_ctx_new ()
goto out;
}
- ctx->mem_acct_enable = 1;
+ ctx->mem_acct_enable = gf_global_mem_acct_enable_get();
INIT_LIST_HEAD (&ctx->graphs);
INIT_LIST_HEAD (&ctx->mempool_list);
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 259c5c885f7..cf707c7af4b 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -81,8 +81,22 @@ static pthread_key_t uuid_buf_key;
static char global_uuid_buf[GF_UUID_BUF_SIZE];
static pthread_key_t lkowner_buf_key;
static char global_lkowner_buf[GF_LKOWNER_BUF_SIZE];
+static int gf_global_mem_acct_enable = 1;
+int
+gf_global_mem_acct_enable_get (void)
+{
+ return gf_global_mem_acct_enable;
+}
+
+int
+gf_global_mem_acct_enable_set (int val)
+{
+ gf_global_mem_acct_enable = val;
+ return 0;
+}
+
void
glusterfs_this_destroy (void *ptr)
{
diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h
index 3e2ba870acc..ce1c64475f4 100644
--- a/libglusterfs/src/globals.h
+++ b/libglusterfs/src/globals.h
@@ -72,4 +72,7 @@ int glusterfs_globals_init (glusterfs_ctx_t *ctx);
extern const char *gf_fop_list[];
+/* mem acct enable/disable */
+int gf_global_mem_acct_enable_get (void);
+int gf_global_mem_acct_enable_set (int val);
#endif /* !_GLOBALS_H */
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 73945e578fe..8059c976368 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -420,6 +420,7 @@ struct _cmd_args {
int background_qlen;
int congestion_threshold;
char *fuse_mountopts;
+ int mem_acct;
/* key args */
char *mount_point;