diff options
| author | Mohamed Ashiq <ashiq333@gmail.com> | 2015-05-19 15:46:01 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-06-26 22:52:01 -0700 | 
| commit | 2b9b3ef3b646989bbc0412dca187b3f5fcad3283 (patch) | |
| tree | 6426321e1e0ac95e8afb12ab3e3047b7625e18a0 /libglusterfs/src/mem-pool.c | |
| parent | f5f5cef19e2afa1e2bcee896269e004353d3180f (diff) | |
mem-pool,stack,store,syncop,timer/libglusterfs : Porting to a new logging framework
Change-Id: Idd3dcaf7eeea5207b3a5210676ce3df64153197f
BUG: 1194640
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
Reviewed-on: http://review.gluster.org/10827
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src/mem-pool.c')
| -rw-r--r-- | libglusterfs/src/mem-pool.c | 36 | 
1 files changed, 24 insertions, 12 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 7d95364c4b2..1ed1aba6c2d 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -25,6 +25,7 @@  #define GLUSTERFS_ENV_MEM_ACCT_STR  "GLUSTERFS_DISABLE_MEM_ACCT"  #include "unittest/unittest.h" +#include "libglusterfs-messages.h"  void  gf_mem_acct_enable_set (void *data) @@ -350,7 +351,8 @@ mem_pool_new_fn (unsigned long sizeof_type,          glusterfs_ctx_t  *ctx = NULL;          if (!sizeof_type || !count) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument"); +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return NULL;          }          padded_sizeof_type = sizeof_type + GF_MEM_POOL_PAD_BOUNDARY; @@ -411,7 +413,8 @@ mem_get0 (struct mem_pool *mem_pool)          void             *ptr = NULL;          if (!mem_pool) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument"); +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return NULL;          } @@ -432,7 +435,8 @@ mem_get (struct mem_pool *mem_pool)          struct mem_pool **pool_ptr = NULL;          if (!mem_pool) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument"); +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return NULL;          } @@ -503,7 +507,8 @@ static int  __is_member (struct mem_pool *pool, void *ptr)  {          if (!pool || !ptr) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument"); +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return -1;          } @@ -528,21 +533,24 @@ mem_put (void *ptr)          struct mem_pool *pool = NULL;          if (!ptr) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument"); +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return;          }          list = head = mem_pool_ptr2chunkhead (ptr);          tmp = mem_pool_from_ptr (head);          if (!tmp) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, 0, +                                  LG_MSG_PTR_HEADER_CORRUPTED,                                    "ptr header is corrupted");                  return;          }          pool = *tmp;          if (!pool) { -                gf_log_callingfn ("mem-pool", GF_LOG_ERROR, +                gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, 0, +                                  LG_MSG_MEMPOOL_PTR_NULL,                                    "mem-pool ptr is NULL");                  return;          } @@ -555,9 +563,12 @@ mem_put (void *ptr)                          in_use = (head + GF_MEM_POOL_LIST_BOUNDARY +                                    GF_MEM_POOL_PTR);                          if (!is_mem_chunk_in_use(in_use)) { -                                gf_log_callingfn ("mem-pool", GF_LOG_CRITICAL, -                                                  "mem_put called on freed ptr %p of mem " -                                                  "pool %p", ptr, pool); +                                gf_msg_callingfn ("mem-pool", GF_LOG_CRITICAL, +                                                  0, +                                                  LG_MSG_MEMPOOL_INVALID_FREE, +                                                  "mem_put called on freed ptr" +                                                  " %p of mem pool %p", ptr, +                                                  pool);                                  break;                          }                          pool->hot_count--; @@ -600,8 +611,9 @@ mem_pool_destroy (struct mem_pool *pool)          if (!pool)                  return; -        gf_log (THIS->name, GF_LOG_INFO, "size=%lu max=%d total=%"PRIu64, -                pool->padded_sizeof_type, pool->max_alloc, pool->alloc_count); +        gf_msg (THIS->name, GF_LOG_INFO, 0, LG_MSG_MEM_POOL_DESTROY, "size=%lu " +                "max=%d total=%"PRIu64, pool->padded_sizeof_type, +                pool->max_alloc, pool->alloc_count);          list_del (&pool->global_list);  | 
