diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2019-03-21 19:51:30 +0200 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2019-06-28 12:49:37 +0200 |
commit | c639b94d2b2b55f15435fe49257184b4a2aaaed1 (patch) | |
tree | 426f2dd4ec88787ed990f0ecd216d9d09c4c5800 | |
parent | 5de46c74b281e6d0cf7168f8869bd179e7fff489 (diff) |
mem-pool: remove dead code.
Backport of:
> Change-Id: I3bbda719027b45e1289db2e6a718627141bcbdc8
> BUG: 1193929
> Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Change-Id: I3bbda719027b45e1289db2e6a718627141bcbdc8
updates: bz#1724210
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
-rw-r--r-- | libglusterfs/src/glusterfs/mem-pool.h | 11 | ||||
-rw-r--r-- | libglusterfs/src/mem-pool.c | 70 |
2 files changed, 0 insertions, 81 deletions
diff --git a/libglusterfs/src/glusterfs/mem-pool.h b/libglusterfs/src/glusterfs/mem-pool.h index 90905fb6ba4..0250b590fd9 100644 --- a/libglusterfs/src/glusterfs/mem-pool.h +++ b/libglusterfs/src/glusterfs/mem-pool.h @@ -308,15 +308,4 @@ mem_pool_destroy(struct mem_pool *pool); void gf_mem_acct_enable_set(void *ctx); -/* hit will be set to : - * _gf_true if the memory is served from mem pool - * _gf_false if the requested size was not present in mem pool and hence - * std alloc'd. - */ -void * -mem_pool_get(unsigned long sizeof_type, gf_boolean_t *hit); - -void * -mem_pool_get0(unsigned long sizeof_type, gf_boolean_t *hit); - #endif /* _MEM_POOL_H */ diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 7051d65f2ad..d717e9ffab9 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -366,10 +366,6 @@ static size_t pool_list_size; #define N_COLD_LISTS 1024 #define POOL_SWEEP_SECS 30 -static unsigned long sweep_times; -static unsigned long sweep_usecs; -static unsigned long frees_to_system; - typedef struct { struct list_head death_row; pooled_obj_hdr_t *cold_lists[N_COLD_LISTS]; @@ -427,7 +423,6 @@ free_obj_list(pooled_obj_hdr_t *victim) next = victim->next; free(victim); victim = next; - ++frees_to_system; } } @@ -439,9 +434,6 @@ pool_sweeper(void *arg) per_thread_pool_list_t *next_pl; per_thread_pool_t *pt_pool; unsigned int i; - struct timeval begin_time; - struct timeval end_time; - struct timeval elapsed; gf_boolean_t poisoned; /* @@ -458,7 +450,6 @@ pool_sweeper(void *arg) state.n_cold_lists = 0; /* First pass: collect stuff that needs our attention. */ - (void)gettimeofday(&begin_time, NULL); (void)pthread_mutex_lock(&pool_lock); list_for_each_entry_safe(pool_list, next_pl, &pool_threads, thr_list) { @@ -471,10 +462,6 @@ pool_sweeper(void *arg) } } (void)pthread_mutex_unlock(&pool_lock); - (void)gettimeofday(&end_time, NULL); - timersub(&end_time, &begin_time, &elapsed); - sweep_usecs += elapsed.tv_sec * 1000000 + elapsed.tv_usec; - sweep_times += 1; /* Second pass: free dead pools. */ (void)pthread_mutex_lock(&pool_free_lock); @@ -880,63 +867,6 @@ mem_get(struct mem_pool *mem_pool) #endif /* GF_DISABLE_MEMPOOL */ } -void * -mem_pool_get(unsigned long sizeof_type, gf_boolean_t *hit) -{ -#if defined(GF_DISABLE_MEMPOOL) - return GF_MALLOC(sizeof_type, gf_common_mt_mem_pool); -#else - pooled_obj_hdr_t *retval; - unsigned int power; - struct mem_pool_shared *pool = NULL; - - if (!sizeof_type) { - gf_msg_callingfn("mem-pool", GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG, - "invalid argument"); - return NULL; - } - - /* We ensure sizeof_type > 1 and the next power of two will be, at least, - * 2^POOL_SMALLEST */ - sizeof_type |= (1 << POOL_SMALLEST) - 1; - power = sizeof(sizeof_type) * 8 - __builtin_clzl(sizeof_type - 1) + 1; - if (power > POOL_LARGEST) { - gf_msg_callingfn("mem-pool", GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG, - "invalid argument"); - return NULL; - } - pool = &pools[power - POOL_SMALLEST]; - - retval = mem_get_from_pool(NULL, pool, hit); - - return retval + 1; -#endif /* GF_DISABLE_MEMPOOL */ -} - -void * -mem_pool_get0(unsigned long sizeof_type, gf_boolean_t *hit) -{ - void *ptr = NULL; - unsigned int power; - struct mem_pool_shared *pool = NULL; - - ptr = mem_pool_get(sizeof_type, hit); - if (ptr) { -#if defined(GF_DISABLE_MEMPOOL) - memset(ptr, 0, sizeof_type); -#else - /* We ensure sizeof_type > 1 and the next power of two will be, at - * least, 2^POOL_SMALLEST */ - sizeof_type |= (1 << POOL_SMALLEST) - 1; - power = sizeof(sizeof_type) * 8 - __builtin_clzl(sizeof_type - 1) + 1; - pool = &pools[power - POOL_SMALLEST]; - memset(ptr, 0, AVAILABLE_SIZE(pool->power_of_two)); -#endif - } - - return ptr; -} - void mem_put(void *ptr) { |