diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-07-29 11:21:16 +0300 |
---|---|---|
committer | MOHIT AGRAWAL <moagrawa@redhat.com> | 2020-08-19 09:48:17 +0000 |
commit | 932bd455f8fd11f2ac04c25c1a6d75279b2b3a08 (patch) | |
tree | abc0dfce5433f2b7060b53a0dc23068d46a2cfdf /libglusterfs/src/glusterfs/mem-pool.h | |
parent | 6f855121cd5b4178239c3eb6a844ae7fececd354 (diff) |
libglusterfs: cleanup --disable-mempool
Use trivial no-op mempool if configured with --disable-mempool.
Cleanup OLD_MEM_POOLS leftovers, adjust related statedumps.
Change-Id: Ibaa90e538a34f6dcd216e45c05dd32d955b151f6
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1359
Diffstat (limited to 'libglusterfs/src/glusterfs/mem-pool.h')
-rw-r--r-- | libglusterfs/src/glusterfs/mem-pool.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/libglusterfs/src/glusterfs/mem-pool.h b/libglusterfs/src/glusterfs/mem-pool.h index 0fd1214e27d..e5b3276d047 100644 --- a/libglusterfs/src/glusterfs/mem-pool.h +++ b/libglusterfs/src/glusterfs/mem-pool.h @@ -202,6 +202,24 @@ out: return dup_mem; } +#ifdef GF_DISABLE_MEMPOOL + +/* No-op memory pool enough to fit current API without massive redesign. */ + +struct mem_pool { + unsigned long sizeof_type; +}; + +#define mem_pools_init() \ + do { \ + } while (0) +#define mem_pools_fini() \ + do { \ + } while (0) +#define mem_pool_thread_destructor(pool_list) (void)pool_list + +#else /* !GF_DISABLE_MEMPOOL */ + /* kind of 'header' for the actual mem_pool_shared structure, this might make * it possible to dump some more details in a statedump */ struct mem_pool { @@ -210,10 +228,10 @@ struct mem_pool { unsigned long count; /* requested pool size (unused) */ char *name; char *xl_name; - gf_atomic_t active; /* current allocations */ + gf_atomic_t active; /* current allocations */ #ifdef DEBUG - gf_atomic_t hit; /* number of allocations served from pt_pool */ - gf_atomic_t miss; /* number of std allocs due to miss */ + gf_atomic_t hit; /* number of allocations served from pt_pool */ + gf_atomic_t miss; /* number of std allocs due to miss */ #endif struct list_head owner; /* glusterfs_ctx_t->mempool_list */ glusterfs_ctx_t *ctx; /* take ctx->lock when updating owner */ @@ -287,6 +305,10 @@ void mem_pools_init(void); /* start the pool_sweeper thread */ void mem_pools_fini(void); /* cleanup memory pools */ +void +mem_pool_thread_destructor(per_thread_pool_list_t *pool_list); + +#endif /* GF_DISABLE_MEMPOOL */ struct mem_pool * mem_pool_new_fn(glusterfs_ctx_t *ctx, unsigned long sizeof_type, @@ -309,9 +331,6 @@ void mem_pool_destroy(struct mem_pool *pool); void -mem_pool_thread_destructor(per_thread_pool_list_t *pool_list); - -void gf_mem_acct_enable_set(void *ctx); #endif /* _MEM_POOL_H */ |