From abc2a6b0b91a82bb59327cd2a4ca72b8954e1425 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 16 Mar 2011 09:39:21 +0000 Subject: glusterfsd: log enhancement Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346 --- libglusterfs/src/globals.c | 82 +++++++++------------------------------------- 1 file changed, 16 insertions(+), 66 deletions(-) (limited to 'libglusterfs/src/globals.c') diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 10f370b5c53..90e4bc41336 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -211,63 +211,6 @@ glusterfs_this_set (xlator_t *this) return 0; } - -/* IS_CENTRAL_LOG */ - -static pthread_key_t central_log_flag_key; - -void -glusterfs_central_log_flag_destroy (void *ptr) -{ - if (ptr) - FREE (ptr); -} - - -int -glusterfs_central_log_flag_init () -{ - int ret = 0; - - ret = pthread_key_create (¢ral_log_flag_key, - glusterfs_central_log_flag_destroy); - - if (ret != 0) { - return ret; - } - - pthread_setspecific (central_log_flag_key, (void *) 0); - - return ret; -} - - -void -glusterfs_central_log_flag_set () -{ - pthread_setspecific (central_log_flag_key, (void *) 1); -} - - -long -glusterfs_central_log_flag_get () -{ - long flag = 0; - - flag = (long) pthread_getspecific (central_log_flag_key); - - return flag; -} - - -void -glusterfs_central_log_flag_unset () -{ - pthread_setspecific (central_log_flag_key, (void *) 0); -} - - - /* SYNCTASK */ static pthread_key_t synctask_key; @@ -352,27 +295,34 @@ glusterfs_globals_init () gf_log_globals_init (); ret = glusterfs_ctx_init (); - if (ret) + if (ret) { + gf_log ("", GF_LOG_CRITICAL, + "ERROR: glusterfs context init failed"); goto out; + } ret = glusterfs_this_init (); - if (ret) - goto out; - - ret = glusterfs_central_log_flag_init (); - if (ret) + if (ret) { + gf_log ("", GF_LOG_CRITICAL, + "ERROR: glusterfs-translator init failed"); goto out; + } ret = glusterfs_uuid_buf_init (); - if(ret) + if(ret) { + gf_log ("", GF_LOG_CRITICAL, + "ERROR: glusterfs uuid buffer init failed"); goto out; + } gf_mem_acct_enable_set (); ret = synctask_init (); - if (ret) + if (ret) { + gf_log ("", GF_LOG_CRITICAL, + "ERROR: glusterfs synctask init failed"); goto out; - + } out: return ret; } -- cgit