From a4e11fd67e3608c828e5bb8abf7a310b4f0a3017 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 16 Jul 2012 15:50:30 -0700 Subject: glusterfs_ctx_t: un-globalize the filesystem context So far there has been a global glusterfs_ctx_t object which represents the running instance of the filesystem (client or server). It contains the various graphs, connection to the management daemon over which new graphs are obtained, calls stacks issued on this filesystem, and a bunch of such things. With the introduction of libgfapi, it is no more true that there will be only one filesystem context in a process. Applications can be written to use libgfapi and obtain serveral instances of different filesystems/volumes in the same process. This involves messy untangling of assumptions inside libglusterfs that there would only be one global glusterfs_ctx_t and offload that assumption to glusterfsd/ and cli/ (where it is true). Change-Id: Ifd7d1259428c26076140a5764a2dc7361694139c BUG: 839950 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.com/3678 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- libglusterfs/src/mem-pool.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'libglusterfs/src/mem-pool.c') diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 3e8100c64..2df47756f 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -38,23 +38,14 @@ gf_mem_acct_is_enabled () return gf_mem_acct_enable; } + void gf_mem_acct_enable_set () { -#ifdef DEBUG - gf_mem_acct_enable = 1; - return; -#endif - glusterfs_ctx_t *ctx = NULL; char *opt = NULL; long val = -1; - gf_mem_acct_enable = 0; - - ctx = glusterfs_ctx_get (); - - if (ctx->mem_accounting) { - gf_mem_acct_enable = 1; + if (gf_mem_acct_enable) { return; } @@ -365,7 +356,7 @@ mem_pool_new_fn (unsigned long sizeof_type, mem_pool->pool_end = pool + (count * (padded_sizeof_type)); /* add this pool to the global list */ - ctx = glusterfs_ctx_get (); + ctx = THIS->ctx; if (!ctx) goto out; -- cgit