diff options
Diffstat (limited to 'libglusterfs/src/mem-pool.c')
| -rw-r--r-- | libglusterfs/src/mem-pool.c | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 66b45c0d669..328c8071e29 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -698,6 +698,7 @@ mem_pool_new_fn (glusterfs_ctx_t *ctx, unsigned long sizeof_type,          new->count = count;          new->name = name;          new->pool = pool; +        GF_ATOMIC_INIT (new->active, 0);          INIT_LIST_HEAD (&new->owner);          LOCK (&ctx->lock); @@ -834,6 +835,8 @@ mem_get (struct mem_pool *mem_pool)          retval->pool_list = pool_list;          retval->power_of_two = mem_pool->pool->power_of_two; +        GF_ATOMIC_INC (mem_pool->active); +          return retval + 1;  #endif /* GF_DISABLE_MEMPOOL */  } @@ -863,6 +866,8 @@ mem_put (void *ptr)          pool_list = hdr->pool_list;          pt_pool = &pool_list->pools[hdr->power_of_two-POOL_SMALLEST]; +        GF_ATOMIC_DEC (hdr->pool->active); +          (void) pthread_spin_lock (&pool_list->lock);          hdr->magic = GF_MEM_INVALID_MAGIC;          hdr->next = pt_pool->hot_list;  | 
