|
|
cb8e9e |
From 658994a4914d8134c4c9f5a9273706c46d88360d Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Mohamed Ashiq <ashiq333@gmail.com>
|
|
|
cb8e9e |
Date: Tue, 19 May 2015 15:46:01 +0530
|
|
|
cb8e9e |
Subject: [PATCH 180/190] mem-pool,stack,store,syncop,timer/libglusterfs : Porting to a new logging framework
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: Idd3dcaf7eeea5207b3a5210676ce3df64153197f
|
|
|
cb8e9e |
BUG: 1231792
|
|
|
cb8e9e |
Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: http://review.gluster.org/10827
|
|
|
cb8e9e |
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
cb8e9e |
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/51751
|
|
|
cb8e9e |
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
libglusterfs/src/client_t.c | 10 +-
|
|
|
cb8e9e |
libglusterfs/src/libglusterfs-messages.h | 6 +-
|
|
|
cb8e9e |
libglusterfs/src/mem-pool.c | 36 +++++---
|
|
|
cb8e9e |
libglusterfs/src/stack.c | 11 ++-
|
|
|
cb8e9e |
libglusterfs/src/stack.h | 14 ++--
|
|
|
cb8e9e |
libglusterfs/src/store.c | 139 ++++++++++++++++--------------
|
|
|
cb8e9e |
libglusterfs/src/syncop-utils.c | 21 +++--
|
|
|
cb8e9e |
libglusterfs/src/syncop.c | 91 +++++++++++---------
|
|
|
cb8e9e |
libglusterfs/src/timer.c | 29 ++++--
|
|
|
cb8e9e |
9 files changed, 202 insertions(+), 155 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c
|
|
|
cb8e9e |
index b7462fc..035658f 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/client_t.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/client_t.c
|
|
|
cb8e9e |
@@ -595,7 +595,7 @@ clienttable_dump (clienttable_t *clienttable, char *prefix)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg ("client_t", GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
- LG_MSG_LOCK_GAIN_FAILED,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
"Unable to acquire lock");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -693,7 +693,7 @@ gf_client_dump_fdtables_to_dict (xlator_t *this, dict_t *dict)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg ("client_t", GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
- LG_MSG_LOCK_GAIN_FAILED,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
"Unable to acquire lock");
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -736,7 +736,7 @@ gf_client_dump_fdtables (xlator_t *this)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg ("client_t", GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
- LG_MSG_LOCK_GAIN_FAILED,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
"Unable to acquire lock");
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -802,7 +802,7 @@ gf_client_dump_inodes_to_dict (xlator_t *this, dict_t *dict)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg ("client_t", GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
- LG_MSG_LOCK_GAIN_FAILED,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
"Unable to acquire lock");
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -864,7 +864,7 @@ gf_client_dump_inodes (xlator_t *this)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
gf_msg ("client_t", GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
- LG_MSG_LOCK_GAIN_FAILED,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
"Unable to acquire lock");
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/libglusterfs-messages.h b/libglusterfs/src/libglusterfs-messages.h
|
|
|
cb8e9e |
index 8b8af36..25cca8b 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/libglusterfs-messages.h
|
|
|
cb8e9e |
+++ b/libglusterfs/src/libglusterfs-messages.h
|
|
|
cb8e9e |
@@ -145,7 +145,7 @@
|
|
|
cb8e9e |
* @recommendedaction
|
|
|
cb8e9e |
*
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
-#define LG_MSG_LOCK_GAIN_FAILED (GLFS_LG_BASE + 14)
|
|
|
cb8e9e |
+#define LG_MSG_LOCK_FAILED (GLFS_LG_BASE + 14)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/*!
|
|
|
cb8e9e |
* @messageid
|
|
|
cb8e9e |
@@ -153,7 +153,7 @@
|
|
|
cb8e9e |
* @recommendedaction
|
|
|
cb8e9e |
*
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
-#define LG_MSG_LOCK_RELEASE_FAILED (GLFS_LG_BASE + 15)
|
|
|
cb8e9e |
+#define LG_MSG_UNLOCK_FAILED (GLFS_LG_BASE + 15)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/*!
|
|
|
cb8e9e |
* @messageid
|
|
|
cb8e9e |
@@ -1198,7 +1198,7 @@
|
|
|
cb8e9e |
*
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-#define LG_MSG_SWAP_FAILED (GLFS_LG_BASE + 137)
|
|
|
cb8e9e |
+#define LG_MSG_SWAPCONTEXT_FAILED (GLFS_LG_BASE + 137)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/*!
|
|
|
cb8e9e |
* @messageid
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
|
|
|
cb8e9e |
index 7d95364..1ed1aba 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/mem-pool.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/mem-pool.c
|
|
|
cb8e9e |
@@ -25,6 +25,7 @@
|
|
|
cb8e9e |
#define GLUSTERFS_ENV_MEM_ACCT_STR "GLUSTERFS_DISABLE_MEM_ACCT"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#include "unittest/unittest.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
void
|
|
|
cb8e9e |
gf_mem_acct_enable_set (void *data)
|
|
|
cb8e9e |
@@ -350,7 +351,8 @@ mem_pool_new_fn (unsigned long sizeof_type,
|
|
|
cb8e9e |
glusterfs_ctx_t *ctx = NULL;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!sizeof_type || !count) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
padded_sizeof_type = sizeof_type + GF_MEM_POOL_PAD_BOUNDARY;
|
|
|
cb8e9e |
@@ -411,7 +413,8 @@ mem_get0 (struct mem_pool *mem_pool)
|
|
|
cb8e9e |
void *ptr = NULL;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!mem_pool) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -432,7 +435,8 @@ mem_get (struct mem_pool *mem_pool)
|
|
|
cb8e9e |
struct mem_pool **pool_ptr = NULL;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!mem_pool) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -503,7 +507,8 @@ static int
|
|
|
cb8e9e |
__is_member (struct mem_pool *pool, void *ptr)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (!pool || !ptr) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -528,21 +533,24 @@ mem_put (void *ptr)
|
|
|
cb8e9e |
struct mem_pool *pool = NULL;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!ptr) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
list = head = mem_pool_ptr2chunkhead (ptr);
|
|
|
cb8e9e |
tmp = mem_pool_from_ptr (head);
|
|
|
cb8e9e |
if (!tmp) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR,
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, 0,
|
|
|
cb8e9e |
+ LG_MSG_PTR_HEADER_CORRUPTED,
|
|
|
cb8e9e |
"ptr header is corrupted");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
pool = *tmp;
|
|
|
cb8e9e |
if (!pool) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_ERROR,
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_ERROR, 0,
|
|
|
cb8e9e |
+ LG_MSG_MEMPOOL_PTR_NULL,
|
|
|
cb8e9e |
"mem-pool ptr is NULL");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -555,9 +563,12 @@ mem_put (void *ptr)
|
|
|
cb8e9e |
in_use = (head + GF_MEM_POOL_LIST_BOUNDARY +
|
|
|
cb8e9e |
GF_MEM_POOL_PTR);
|
|
|
cb8e9e |
if (!is_mem_chunk_in_use(in_use)) {
|
|
|
cb8e9e |
- gf_log_callingfn ("mem-pool", GF_LOG_CRITICAL,
|
|
|
cb8e9e |
- "mem_put called on freed ptr %p of mem "
|
|
|
cb8e9e |
- "pool %p", ptr, pool);
|
|
|
cb8e9e |
+ gf_msg_callingfn ("mem-pool", GF_LOG_CRITICAL,
|
|
|
cb8e9e |
+ 0,
|
|
|
cb8e9e |
+ LG_MSG_MEMPOOL_INVALID_FREE,
|
|
|
cb8e9e |
+ "mem_put called on freed ptr"
|
|
|
cb8e9e |
+ " %p of mem pool %p", ptr,
|
|
|
cb8e9e |
+ pool);
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
pool->hot_count--;
|
|
|
cb8e9e |
@@ -600,8 +611,9 @@ mem_pool_destroy (struct mem_pool *pool)
|
|
|
cb8e9e |
if (!pool)
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log (THIS->name, GF_LOG_INFO, "size=%lu max=%d total=%"PRIu64,
|
|
|
cb8e9e |
- pool->padded_sizeof_type, pool->max_alloc, pool->alloc_count);
|
|
|
cb8e9e |
+ gf_msg (THIS->name, GF_LOG_INFO, 0, LG_MSG_MEM_POOL_DESTROY, "size=%lu "
|
|
|
cb8e9e |
+ "max=%d total=%"PRIu64, pool->padded_sizeof_type,
|
|
|
cb8e9e |
+ pool->max_alloc, pool->alloc_count);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
list_del (&pool->global_list);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
|
|
|
cb8e9e |
index a7fb951..12d5759 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/stack.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/stack.c
|
|
|
cb8e9e |
@@ -10,6 +10,7 @@
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#include "statedump.h"
|
|
|
cb8e9e |
#include "stack.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
static inline
|
|
|
cb8e9e |
int call_frames_count (call_frame_t *call_frame)
|
|
|
cb8e9e |
@@ -46,8 +47,9 @@ create_frame (xlator_t *xl, call_pool_t *pool)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (stack->ctx->measure_latency) {
|
|
|
cb8e9e |
if (gettimeofday (&stack->tv, NULL) == -1)
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_ERROR, "gettimeofday () failed."
|
|
|
cb8e9e |
- " (%s)", strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("stack", GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_GETTIMEOFDAY_FAILED,
|
|
|
cb8e9e |
+ "gettimeofday () failed");
|
|
|
cb8e9e |
memcpy (&stack->frames.begin, &stack->tv, sizeof (stack->tv));
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -399,8 +401,9 @@ gf_proc_dump_pending_frames_to_dict (call_pool_t *call_pool, dict_t *dict)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = TRY_LOCK (&call_pool->lock);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log (THIS->name, GF_LOG_WARNING, "Unable to dump call pool"
|
|
|
cb8e9e |
- " to dict. errno: %d", errno);
|
|
|
cb8e9e |
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
|
|
|
cb8e9e |
+ LG_MSG_LOCK_FAILURE, "Unable to dump call "
|
|
|
cb8e9e |
+ "pool to dict.");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
|
|
|
cb8e9e |
index f2d2ef9..38ca3ee 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/stack.h
|
|
|
cb8e9e |
+++ b/libglusterfs/src/stack.h
|
|
|
cb8e9e |
@@ -37,6 +37,7 @@ typedef struct call_pool call_pool_t;
|
|
|
cb8e9e |
#include "globals.h"
|
|
|
cb8e9e |
#include "lkowner.h"
|
|
|
cb8e9e |
#include "client_t.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#define NFS_PID 1
|
|
|
cb8e9e |
#define LOW_PRIO_PROC_PID -1
|
|
|
cb8e9e |
@@ -233,7 +234,6 @@ STACK_RESET (call_stack_t *stack)
|
|
|
cb8e9e |
\
|
|
|
cb8e9e |
_new = mem_get0 (frame->root->pool->frame_mem_pool); \
|
|
|
cb8e9e |
if (!_new) { \
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_ERROR, "alloc failed"); \
|
|
|
cb8e9e |
break; \
|
|
|
cb8e9e |
} \
|
|
|
cb8e9e |
typeof(fn##_cbk) tmp_cbk = rfn; \
|
|
|
cb8e9e |
@@ -288,7 +288,6 @@ STACK_RESET (call_stack_t *stack)
|
|
|
cb8e9e |
\
|
|
|
cb8e9e |
_new = mem_get0 (frame->root->pool->frame_mem_pool); \
|
|
|
cb8e9e |
if (!_new) { \
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_ERROR, "alloc failed"); \
|
|
|
cb8e9e |
break; \
|
|
|
cb8e9e |
} \
|
|
|
cb8e9e |
typeof(fn##_cbk) tmp_cbk = rfn; \
|
|
|
cb8e9e |
@@ -328,7 +327,8 @@ STACK_RESET (call_stack_t *stack)
|
|
|
cb8e9e |
call_frame_t *_parent = NULL; \
|
|
|
cb8e9e |
xlator_t *old_THIS = NULL; \
|
|
|
cb8e9e |
if (!frame) { \
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_CRITICAL, "!frame"); \
|
|
|
cb8e9e |
+ gf_msg ("stack", GF_LOG_CRITICAL, 0, \
|
|
|
cb8e9e |
+ LG_MSG_FRAME_ERROR, "!frame"); \
|
|
|
cb8e9e |
break; \
|
|
|
cb8e9e |
} \
|
|
|
cb8e9e |
fn = frame->ret; \
|
|
|
cb8e9e |
@@ -357,7 +357,8 @@ STACK_RESET (call_stack_t *stack)
|
|
|
cb8e9e |
xlator_t *old_THIS = NULL; \
|
|
|
cb8e9e |
\
|
|
|
cb8e9e |
if (!frame) { \
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_CRITICAL, "!frame"); \
|
|
|
cb8e9e |
+ gf_msg ("stack", GF_LOG_CRITICAL, 0, \
|
|
|
cb8e9e |
+ LG_MSG_FRAME_ERROR, "!frame"); \
|
|
|
cb8e9e |
break; \
|
|
|
cb8e9e |
} \
|
|
|
cb8e9e |
fn = (fop_##op##_cbk_t )frame->ret; \
|
|
|
cb8e9e |
@@ -435,8 +436,9 @@ copy_frame (call_frame_t *frame)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (newstack->ctx->measure_latency) {
|
|
|
cb8e9e |
if (gettimeofday (&newstack->tv, NULL) == -1)
|
|
|
cb8e9e |
- gf_log ("stack", GF_LOG_ERROR, "gettimeofday () failed."
|
|
|
cb8e9e |
- " (%s)", strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("stack", GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_GETTIMEOFDAY_FAILED,
|
|
|
cb8e9e |
+ "gettimeofday () failed.");
|
|
|
cb8e9e |
memcpy (&newstack->frames.begin, &newstack->tv,
|
|
|
cb8e9e |
sizeof (newstack->tv));
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c
|
|
|
cb8e9e |
index 351741f..7c8b29d 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/store.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/store.c
|
|
|
cb8e9e |
@@ -20,7 +20,7 @@
|
|
|
cb8e9e |
#include "store.h"
|
|
|
cb8e9e |
#include "dict.h"
|
|
|
cb8e9e |
#include "xlator.h"
|
|
|
cb8e9e |
-
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
int32_t
|
|
|
cb8e9e |
gf_store_mkdir (char *path)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
@@ -29,8 +29,8 @@ gf_store_mkdir (char *path)
|
|
|
cb8e9e |
ret = mkdir (path, 0777);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if ((-1 == ret) && (EEXIST != errno)) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "mkdir() failed on path %s,"
|
|
|
cb8e9e |
- "errno: %s", path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED, "mkdir()"
|
|
|
cb8e9e |
+ " failed on path %s.", path);
|
|
|
cb8e9e |
} else {
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -49,8 +49,9 @@ gf_store_handle_create_on_absence (gf_store_handle_t **shandle,
|
|
|
cb8e9e |
ret = gf_store_handle_new (path, shandle);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Unable to create store"
|
|
|
cb8e9e |
- " handle for path: %s", path);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, 0,
|
|
|
cb8e9e |
+ LG_MSG_STORE_HANDLE_CREATE_FAILED, "Unable to"
|
|
|
cb8e9e |
+ " create store handle for path: %s", path);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
@@ -67,8 +68,8 @@ gf_store_mkstemp (gf_store_handle_t *shandle)
|
|
|
cb8e9e |
snprintf (tmppath, sizeof (tmppath), "%s.tmp", shandle->path);
|
|
|
cb8e9e |
shandle->tmp_fd = open (tmppath, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
|
|
cb8e9e |
if (shandle->tmp_fd < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to open %s, error: %s",
|
|
|
cb8e9e |
- tmppath, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to open %s.", tmppath);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
return shandle->tmp_fd;
|
|
|
cb8e9e |
@@ -92,15 +93,15 @@ gf_store_sync_direntry (char *path)
|
|
|
cb8e9e |
pdir = dirname (dir);
|
|
|
cb8e9e |
dirfd = open (pdir, O_RDONLY);
|
|
|
cb8e9e |
if (dirfd == -1) {
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_ERROR, "Failed to open directory "
|
|
|
cb8e9e |
- "%s, due to %s", pdir, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg (this->name, GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to open directory %s.", pdir);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = fsync (dirfd);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_ERROR, "Failed to fsync %s, due to "
|
|
|
cb8e9e |
- "%s", pdir, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_DIR_OP_FAILED, "Failed to fsync %s.", pdir);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -109,8 +110,9 @@ out:
|
|
|
cb8e9e |
if (dirfd >= 0) {
|
|
|
cb8e9e |
ret = close (dirfd);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_ERROR, "Failed to close "
|
|
|
cb8e9e |
- "%s, due to %s", pdir, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_DIR_OP_FAILED, "Failed to close %s",
|
|
|
cb8e9e |
+ pdir);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -131,15 +133,16 @@ gf_store_rename_tmppath (gf_store_handle_t *shandle)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = fsync (shandle->tmp_fd);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to fsync %s, "
|
|
|
cb8e9e |
- "error: %s", shandle->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg (THIS->name, GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to fsync %s", shandle->path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
snprintf (tmppath, sizeof (tmppath), "%s.tmp", shandle->path);
|
|
|
cb8e9e |
ret = rename (tmppath, shandle->path);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to rename %s to %s, "
|
|
|
cb8e9e |
- "error: %s", tmppath, shandle->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg (THIS->name, GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to rename %s to %s", tmppath,
|
|
|
cb8e9e |
+ shandle->path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -164,8 +167,9 @@ gf_store_unlink_tmppath (gf_store_handle_t *shandle)
|
|
|
cb8e9e |
snprintf (tmppath, sizeof (tmppath), "%s.tmp", shandle->path);
|
|
|
cb8e9e |
ret = unlink (tmppath);
|
|
|
cb8e9e |
if (ret && (errno != ENOENT)) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to mv %s to %s, error: %s",
|
|
|
cb8e9e |
- tmppath, shandle->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to mv %s to %s", tmppath,
|
|
|
cb8e9e |
+ shandle->path);
|
|
|
cb8e9e |
} else {
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -248,8 +252,8 @@ gf_store_retrieve_value (gf_store_handle_t *handle, char *key, char **value)
|
|
|
cb8e9e |
lseek (handle->fd, 0, SEEK_SET);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (handle->fd == -1) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Unable to open file %s errno: %s",
|
|
|
cb8e9e |
- handle->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Unable to open file %s", handle->path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
if (!handle->read)
|
|
|
cb8e9e |
@@ -258,15 +262,15 @@ gf_store_retrieve_value (gf_store_handle_t *handle, char *key, char **value)
|
|
|
cb8e9e |
fseek (handle->read, 0, SEEK_SET);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!handle->read) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Unable to open file %s errno: %s",
|
|
|
cb8e9e |
- handle->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Unable to open file %s", handle->path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = fstat (handle->fd, &st);
|
|
|
cb8e9e |
if (ret < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "stat on file %s failed",
|
|
|
cb8e9e |
- handle->path);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "stat on file %s failed", handle->path);
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
store_errno = GD_STORE_STAT_FAILED;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
@@ -292,16 +296,16 @@ gf_store_retrieve_value (gf_store_handle_t *handle, char *key, char **value)
|
|
|
cb8e9e |
&iter_key, &iter_val,
|
|
|
cb8e9e |
&store_errno);
|
|
|
cb8e9e |
if (ret < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "error while reading key "
|
|
|
cb8e9e |
- "'%s': %s", key,
|
|
|
cb8e9e |
- gf_store_strerror (store_errno));
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "error while reading key '%s': "
|
|
|
cb8e9e |
+ "%s", key,
|
|
|
cb8e9e |
+ gf_store_strerror (store_errno));
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "key %s read", iter_key);
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "key %s read", iter_key);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!strcmp (key, iter_key)) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "key %s found", key);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "key %s found", key);
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
if (iter_val)
|
|
|
cb8e9e |
*value = gf_strdup (iter_val);
|
|
|
cb8e9e |
@@ -341,25 +345,25 @@ gf_store_save_value (int fd, char *key, char *value)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
fp = fdopen (dup_fd, "a+");
|
|
|
cb8e9e |
if (fp == NULL) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "fdopen failed.");
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "fdopen failed.");
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = fprintf (fp, "%s=%s\n", key, value);
|
|
|
cb8e9e |
if (ret < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "Unable to store key: %s,"
|
|
|
cb8e9e |
- "value: %s, error: %s", key, value,
|
|
|
cb8e9e |
- strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Unable to store key: %s, value: %s.",
|
|
|
cb8e9e |
+ key, value);
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = fflush (fp);
|
|
|
cb8e9e |
if (feof (fp)) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING,
|
|
|
cb8e9e |
- "fflush failed, error: %s",
|
|
|
cb8e9e |
- strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "fflush failed.");
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -369,7 +373,7 @@ out:
|
|
|
cb8e9e |
if (fp)
|
|
|
cb8e9e |
fclose (fp);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "returning: %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "returning: %d", ret);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -391,8 +395,8 @@ gf_store_handle_new (const char *path, gf_store_handle_t **handle)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
fd = open (path, O_RDWR | O_CREAT | O_APPEND, 0600);
|
|
|
cb8e9e |
if (fd < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to open file: %s, error: %s",
|
|
|
cb8e9e |
- path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to open file: %s.", path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -415,7 +419,7 @@ out:
|
|
|
cb8e9e |
GF_FREE (shandle);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "Returning %d", ret);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -427,14 +431,13 @@ gf_store_handle_retrieve (char *path, gf_store_handle_t **handle)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = stat (path, &statbuf);
|
|
|
cb8e9e |
if (ret) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Path corresponding to "
|
|
|
cb8e9e |
- "%s, returned error: (%s)",
|
|
|
cb8e9e |
- path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_PATH_NOT_FOUND, "Path "
|
|
|
cb8e9e |
+ "corresponding to %s.", path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
ret = gf_store_handle_new (path, handle);
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "Returning %d", ret);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -455,7 +458,7 @@ gf_store_handle_destroy (gf_store_handle_t *handle)
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "Returning %d", ret);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -472,8 +475,8 @@ gf_store_iter_new (gf_store_handle_t *shandle, gf_store_iter_t **iter)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
fp = fopen (shandle->path, "r");
|
|
|
cb8e9e |
if (!fp) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Unable to open file %s errno: %d",
|
|
|
cb8e9e |
- shandle->path, errno);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Unable to open file %s", shandle->path);
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -496,7 +499,7 @@ out:
|
|
|
cb8e9e |
|
|
|
cb8e9e |
GF_FREE (tmp_iter);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "Returning with %d", ret);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -511,19 +514,21 @@ gf_store_validate_key_value (char *storepath, char *key, char *val,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if ((key == NULL) && (val == NULL)) {
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
|
|
|
cb8e9e |
- "Invalid key and value (null) in %s", storepath);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "Glusterd "
|
|
|
cb8e9e |
+ "store may be corrupted, Invalid key and value (null)"
|
|
|
cb8e9e |
+ " in %s", storepath);
|
|
|
cb8e9e |
*op_errno = GD_STORE_KEY_VALUE_NULL;
|
|
|
cb8e9e |
} else if (key == NULL) {
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
|
|
|
cb8e9e |
- "Invalid key (null) in %s", storepath);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "Glusterd "
|
|
|
cb8e9e |
+ "store may be corrupted, Invalid key (null) in %s",
|
|
|
cb8e9e |
+ storepath);
|
|
|
cb8e9e |
*op_errno = GD_STORE_KEY_NULL;
|
|
|
cb8e9e |
} else if (val == NULL) {
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
|
|
|
cb8e9e |
- "Invalid value (null) for key %s in %s", key,
|
|
|
cb8e9e |
- storepath);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "Glusterd "
|
|
|
cb8e9e |
+ "store may be corrupted, Invalid value (null) for key"
|
|
|
cb8e9e |
+ " %s in %s", key, storepath);
|
|
|
cb8e9e |
*op_errno = GD_STORE_VALUE_NULL;
|
|
|
cb8e9e |
} else {
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
@@ -550,7 +555,8 @@ gf_store_iter_get_next (gf_store_iter_t *iter, char **key, char **value,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = stat (iter->filepath, &st);
|
|
|
cb8e9e |
if (ret < 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "stat on file failed");
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "stat on file failed");
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
store_errno = GD_STORE_STAT_FAILED;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
@@ -605,7 +611,7 @@ out:
|
|
|
cb8e9e |
if (op_errno)
|
|
|
cb8e9e |
*op_errno = store_errno;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
|
|
|
cb8e9e |
+ gf_msg_debug ("", 0, "Returning with %d", ret);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -646,8 +652,9 @@ gf_store_iter_destroy (gf_store_iter_t *iter)
|
|
|
cb8e9e |
* being NULL*/
|
|
|
cb8e9e |
ret = fclose (iter->file);
|
|
|
cb8e9e |
if (ret)
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Unable to close file: %s, ret: %d, "
|
|
|
cb8e9e |
- "errno: %d" ,iter->filepath, ret, errno);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED, "Unable"
|
|
|
cb8e9e |
+ " to close file: %s, ret: %d" ,
|
|
|
cb8e9e |
+ iter->filepath, ret);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
GF_FREE (iter);
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
@@ -685,15 +692,15 @@ gf_store_lock (gf_store_handle_t *sh)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
sh->fd = open (sh->path, O_RDWR);
|
|
|
cb8e9e |
if (sh->fd == -1) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to open '%s': %s", sh->path,
|
|
|
cb8e9e |
- strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED,
|
|
|
cb8e9e |
+ "Failed to open '%s'", sh->path);
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = lockf (sh->fd, F_LOCK, 0);
|
|
|
cb8e9e |
if (ret)
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to gain lock on '%s': %s",
|
|
|
cb8e9e |
- sh->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_LOCK_FAILED,
|
|
|
cb8e9e |
+ "Failed to gain lock on '%s'", sh->path);
|
|
|
cb8e9e |
else
|
|
|
cb8e9e |
/* sh->locked is protected by the lockf(sh->fd) above */
|
|
|
cb8e9e |
sh->locked = F_LOCK;
|
|
|
cb8e9e |
@@ -711,8 +718,8 @@ gf_store_unlock (gf_store_handle_t *sh)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/* does not matter if this fails, locks are released on close anyway */
|
|
|
cb8e9e |
if (lockf (sh->fd, F_ULOCK, 0) == -1)
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_ERROR, "Failed to release lock on '%s': %s",
|
|
|
cb8e9e |
- sh->path, strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_UNLOCK_FAILED,
|
|
|
cb8e9e |
+ "Failed to release lock on '%s'", sh->path);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
close (sh->fd);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
|
|
|
cb8e9e |
index 349fa92..8ab6bef 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/syncop-utils.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/syncop-utils.c
|
|
|
cb8e9e |
@@ -15,6 +15,7 @@
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#include "syncop.h"
|
|
|
cb8e9e |
#include "common-utils.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
int
|
|
|
cb8e9e |
syncop_dirfd (xlator_t *subvol, loc_t *loc, fd_t **fd, int pid)
|
|
|
cb8e9e |
@@ -27,9 +28,9 @@ syncop_dirfd (xlator_t *subvol, loc_t *loc, fd_t **fd, int pid)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
dirfd = fd_create (loc->inode, pid);
|
|
|
cb8e9e |
if (!dirfd) {
|
|
|
cb8e9e |
- gf_log (subvol->name, GF_LOG_ERROR,
|
|
|
cb8e9e |
- "fd_create of %s failed: %s",
|
|
|
cb8e9e |
- uuid_utoa (loc->gfid), strerror(errno));
|
|
|
cb8e9e |
+ gf_msg (subvol->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_FD_CREATE_FAILED, "fd_create of %s",
|
|
|
cb8e9e |
+ uuid_utoa (loc->gfid));
|
|
|
cb8e9e |
ret = -errno;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -49,18 +50,18 @@ syncop_dirfd (xlator_t *subvol, loc_t *loc, fd_t **fd, int pid)
|
|
|
cb8e9e |
fd_unref (dirfd);
|
|
|
cb8e9e |
dirfd = fd_anonymous (loc->inode);
|
|
|
cb8e9e |
if (!dirfd) {
|
|
|
cb8e9e |
- gf_log(subvol->name, GF_LOG_ERROR,
|
|
|
cb8e9e |
- "fd_anonymous of %s failed: %s",
|
|
|
cb8e9e |
- uuid_utoa (loc->gfid), strerror(errno));
|
|
|
cb8e9e |
+ gf_msg (subvol->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_FD_ANONYMOUS_FAILED, "fd_anonymous of "
|
|
|
cb8e9e |
+ "%s", uuid_utoa (loc->gfid));
|
|
|
cb8e9e |
ret = -errno;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
#else /* GF_LINUX_HOST_OS */
|
|
|
cb8e9e |
fd_unref (dirfd);
|
|
|
cb8e9e |
- gf_log (subvol->name, GF_LOG_ERROR,
|
|
|
cb8e9e |
- "opendir of %s failed: %s",
|
|
|
cb8e9e |
- uuid_utoa (loc->gfid), strerror(errno));
|
|
|
cb8e9e |
+ gf_msg (subvol->name, GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_DIR_OP_FAILED, "opendir of %s",
|
|
|
cb8e9e |
+ uuid_utoa (loc->gfid));
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
#endif /* GF_LINUX_HOST_OS */
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -304,7 +305,7 @@ syncop_is_subvol_local (xlator_t *this, loc_t *loc, gf_boolean_t *is_local)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
ret = glusterfs_is_local_pathinfo (pathinfo, is_local);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_DEBUG, "subvol %s is %slocal",
|
|
|
cb8e9e |
+ gf_msg_debug (this->name, 0, "subvol %s is %slocal",
|
|
|
cb8e9e |
this->name, is_local ? "" : "not ");
|
|
|
cb8e9e |
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
|
|
|
cb8e9e |
index 48daa32..26a4737 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/syncop.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/syncop.c
|
|
|
cb8e9e |
@@ -14,6 +14,7 @@
|
|
|
cb8e9e |
#endif
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#include "syncop.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
int
|
|
|
cb8e9e |
syncopctx_setfsuid (void *uid)
|
|
|
cb8e9e |
@@ -262,20 +263,21 @@ __run (struct synctask *task)
|
|
|
cb8e9e |
case SYNCTASK_SUSPEND:
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case SYNCTASK_RUN:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_DEBUG,
|
|
|
cb8e9e |
- "re-running already running task");
|
|
|
cb8e9e |
+ gf_msg_debug (task->xl->name, 0, "re-running already running"
|
|
|
cb8e9e |
+ " task");
|
|
|
cb8e9e |
env->runcount--;
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case SYNCTASK_WAIT:
|
|
|
cb8e9e |
env->waitcount--;
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case SYNCTASK_DONE:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_WARNING,
|
|
|
cb8e9e |
- "running completed task");
|
|
|
cb8e9e |
+ gf_msg (task->xl->name, GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
+ LG_MSG_COMPLETED_TASK, "running completed task");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
case SYNCTASK_ZOMBIE:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_WARNING,
|
|
|
cb8e9e |
- "attempted to wake up zombie!!");
|
|
|
cb8e9e |
+ gf_msg (task->xl->name, GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
+ LG_MSG_WAKE_UP_ZOMBIE, "attempted to wake up "
|
|
|
cb8e9e |
+ "zombie!!");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -301,16 +303,19 @@ __wait (struct synctask *task)
|
|
|
cb8e9e |
env->runcount--;
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case SYNCTASK_WAIT:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_WARNING,
|
|
|
cb8e9e |
- "re-waiting already waiting task");
|
|
|
cb8e9e |
+ gf_msg (task->xl->name, GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
+ LG_MSG_REWAITING_TASK, "re-waiting already waiting "
|
|
|
cb8e9e |
+ "task");
|
|
|
cb8e9e |
env->waitcount--;
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case SYNCTASK_DONE:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_WARNING,
|
|
|
cb8e9e |
+ gf_msg (task->xl->name, GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
+ LG_MSG_COMPLETED_TASK,
|
|
|
cb8e9e |
"running completed task");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
case SYNCTASK_ZOMBIE:
|
|
|
cb8e9e |
- gf_log (task->xl->name, GF_LOG_WARNING,
|
|
|
cb8e9e |
+ gf_msg (task->xl->name, GF_LOG_WARNING, 0,
|
|
|
cb8e9e |
+ LG_MSG_SLEEP_ZOMBIE,
|
|
|
cb8e9e |
"attempted to sleep a zombie!!");
|
|
|
cb8e9e |
return;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -336,8 +341,9 @@ synctask_yield (struct synctask *task)
|
|
|
cb8e9e |
(void) gf_backtrace_save (task->btbuf);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
if (swapcontext (&task->ctx, &task->proc->sched) < 0) {
|
|
|
cb8e9e |
- gf_log ("syncop", GF_LOG_ERROR,
|
|
|
cb8e9e |
- "swapcontext failed (%s)", strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("syncop", GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_SWAPCONTEXT_FAILED, "swapcontext failed (%s)",
|
|
|
cb8e9e |
+ strerror (errno));
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
THIS = oldTHIS;
|
|
|
cb8e9e |
@@ -488,16 +494,14 @@ synctask_create (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk,
|
|
|
cb8e9e |
INIT_LIST_HEAD (&newtask->waitq);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (getcontext (&newtask->ctx) < 0) {
|
|
|
cb8e9e |
- gf_log ("syncop", GF_LOG_ERROR,
|
|
|
cb8e9e |
- "getcontext failed (%s)",
|
|
|
cb8e9e |
+ gf_msg ("syncop", GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_GETCONTEXT_FAILED, "getcontext failed (%s)",
|
|
|
cb8e9e |
strerror (errno));
|
|
|
cb8e9e |
goto err;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
newtask->stack = CALLOC (1, env->stacksize);
|
|
|
cb8e9e |
if (!newtask->stack) {
|
|
|
cb8e9e |
- gf_log ("syncop", GF_LOG_ERROR,
|
|
|
cb8e9e |
- "out of memory for stack");
|
|
|
cb8e9e |
goto err;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -648,8 +652,8 @@ synctask_switchto (struct synctask *task)
|
|
|
cb8e9e |
#endif
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (swapcontext (&task->proc->sched, &task->ctx) < 0) {
|
|
|
cb8e9e |
- gf_log ("syncop", GF_LOG_ERROR,
|
|
|
cb8e9e |
- "swapcontext failed (%s)", strerror (errno));
|
|
|
cb8e9e |
+ gf_msg ("syncop", GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ LG_MSG_SWAPCONTEXT_FAILED, "swapcontext failed");
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (task->state == SYNCTASK_DONE) {
|
|
|
cb8e9e |
@@ -874,22 +878,25 @@ __synclock_lock (struct synclock *lock)
|
|
|
cb8e9e |
case LOCK_TASK:
|
|
|
cb8e9e |
if (task == lock->owner) {
|
|
|
cb8e9e |
lock->lock++;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "Recursive lock called by "
|
|
|
cb8e9e |
- "sync task.owner= %p,lock=%d", lock->owner, lock->lock);
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "Recursive lock called by"
|
|
|
cb8e9e |
+ " sync task.owner= %p,lock=%d",
|
|
|
cb8e9e |
+ lock->owner, lock->lock);
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case LOCK_THREAD:
|
|
|
cb8e9e |
if (pthread_self () == lock->owner_tid) {
|
|
|
cb8e9e |
lock->lock++;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "Recursive lock called by "
|
|
|
cb8e9e |
- "thread ,owner=%u lock=%d", (unsigned int) lock->owner_tid,
|
|
|
cb8e9e |
- lock->lock);
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "Recursive lock called by"
|
|
|
cb8e9e |
+ " thread ,owner=%u lock=%d",
|
|
|
cb8e9e |
+ (unsigned int) lock->owner_tid,
|
|
|
cb8e9e |
+ lock->lock);
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
default:
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_CRITICAL, "unknown lock type");
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_CRITICAL, 0,
|
|
|
cb8e9e |
+ LG_MSG_UNKNOWN_LOCK_TYPE, "unknown lock type");
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -974,7 +981,8 @@ __synclock_unlock (synclock_t *lock)
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (lock->lock == 0) {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_CRITICAL, "Unlock called before lock ");
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_UNLOCK_BEFORE_LOCK,
|
|
|
cb8e9e |
+ "Unlock called before lock ");
|
|
|
cb8e9e |
return -1;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
curr = synctask_get ();
|
|
|
cb8e9e |
@@ -986,23 +994,27 @@ __synclock_unlock (synclock_t *lock)
|
|
|
cb8e9e |
case LOCK_TASK:
|
|
|
cb8e9e |
if (curr == lock->owner) {
|
|
|
cb8e9e |
lock->lock--;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "Unlock success %p, remaining"
|
|
|
cb8e9e |
- " locks=%d", lock->owner, lock->lock);
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "Unlock success %p, remaining"
|
|
|
cb8e9e |
+ " locks=%d", lock->owner, lock->lock);
|
|
|
cb8e9e |
} else {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "Unlock called by %p, but"
|
|
|
cb8e9e |
- " lock held by %p", curr, lock->owner);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, 0, LG_MSG_LOCK_OWNER_ERROR,
|
|
|
cb8e9e |
+ "Unlock called by %p, but lock held by %p",
|
|
|
cb8e9e |
+ curr, lock->owner);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
case LOCK_THREAD:
|
|
|
cb8e9e |
if (pthread_self () == lock->owner_tid) {
|
|
|
cb8e9e |
lock->lock--;
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_TRACE, "Unlock success %u, remaining"
|
|
|
cb8e9e |
- " locks=%d", (unsigned int)lock->owner_tid, lock->lock);
|
|
|
cb8e9e |
+ gf_msg_trace ("", 0, "Unlock success %u, remaining "
|
|
|
cb8e9e |
+ "locks=%d",
|
|
|
cb8e9e |
+ (unsigned int)lock->owner_tid,
|
|
|
cb8e9e |
+ lock->lock);
|
|
|
cb8e9e |
} else {
|
|
|
cb8e9e |
- gf_log ("", GF_LOG_WARNING, "Unlock called by %u, but"
|
|
|
cb8e9e |
- " lock held by %u", (unsigned int) pthread_self(),
|
|
|
cb8e9e |
- (unsigned int) lock->owner_tid);
|
|
|
cb8e9e |
+ gf_msg ("", GF_LOG_WARNING, 0, LG_MSG_LOCK_OWNER_ERROR,
|
|
|
cb8e9e |
+ "Unlock called by %u, but lock held by %u",
|
|
|
cb8e9e |
+ (unsigned int) pthread_self(),
|
|
|
cb8e9e |
+ (unsigned int) lock->owner_tid);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
@@ -1244,9 +1256,8 @@ syncop_readdirp_cbk (call_frame_t *frame,
|
|
|
cb8e9e |
if (op_ret >= 0) {
|
|
|
cb8e9e |
list_for_each_entry (entry, &entries->list, list) {
|
|
|
cb8e9e |
tmp = entry_copy (entry);
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
cb8e9e |
- "adding entry=%s, count=%d",
|
|
|
cb8e9e |
- tmp->d_name, count);
|
|
|
cb8e9e |
+ gf_msg_trace (this->name, 0, "adding entry=%s, "
|
|
|
cb8e9e |
+ "count=%d", tmp->d_name, count);
|
|
|
cb8e9e |
list_add_tail (&tmp->list, &(args->entries.list));
|
|
|
cb8e9e |
count++;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -1313,9 +1324,9 @@ syncop_readdir_cbk (call_frame_t *frame,
|
|
|
cb8e9e |
if (op_ret >= 0) {
|
|
|
cb8e9e |
list_for_each_entry (entry, &entries->list, list) {
|
|
|
cb8e9e |
tmp = entry_copy (entry);
|
|
|
cb8e9e |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
cb8e9e |
- "adding entry=%s, count=%d",
|
|
|
cb8e9e |
- tmp->d_name, count);
|
|
|
cb8e9e |
+ gf_msg_trace (this->name, 0, "adding "
|
|
|
cb8e9e |
+ "entry=%s, count=%d", tmp->d_name,
|
|
|
cb8e9e |
+ count);
|
|
|
cb8e9e |
list_add_tail (&tmp->list, &(args->entries.list));
|
|
|
cb8e9e |
count++;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c
|
|
|
cb8e9e |
index 0d845cd..8344c9b 100644
|
|
|
cb8e9e |
--- a/libglusterfs/src/timer.c
|
|
|
cb8e9e |
+++ b/libglusterfs/src/timer.c
|
|
|
cb8e9e |
@@ -18,6 +18,7 @@
|
|
|
cb8e9e |
#include "common-utils.h"
|
|
|
cb8e9e |
#include "globals.h"
|
|
|
cb8e9e |
#include "timespec.h"
|
|
|
cb8e9e |
+#include "libglusterfs-messages.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
gf_timer_t *
|
|
|
cb8e9e |
gf_timer_call_after (glusterfs_ctx_t *ctx,
|
|
|
cb8e9e |
@@ -32,7 +33,8 @@ gf_timer_call_after (glusterfs_ctx_t *ctx,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (ctx == NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -41,14 +43,17 @@ gf_timer_call_after (glusterfs_ctx_t *ctx,
|
|
|
cb8e9e |
* when cleanup_started is set after checking for it
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
if (ctx->cleanup_started) {
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_INFO, "ctx cleanup started");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_INFO, 0,
|
|
|
cb8e9e |
+ LG_MSG_CTX_CLEANUP_STARTED, "ctx cleanup "
|
|
|
cb8e9e |
+ "started");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
reg = gf_timer_registry_init (ctx);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!reg) {
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "!reg");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, 0,
|
|
|
cb8e9e |
+ LG_MSG_TIMER_REGISTER_ERROR, "!reg");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -85,7 +90,8 @@ gf_timer_call_stale (gf_timer_registry_t *reg,
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (reg == NULL || event == NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -107,13 +113,15 @@ gf_timer_call_cancel (glusterfs_ctx_t *ctx,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (ctx == NULL || event == NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
reg = gf_timer_registry_init (ctx);
|
|
|
cb8e9e |
if (!reg) {
|
|
|
cb8e9e |
- gf_log ("timer", GF_LOG_ERROR, "!reg");
|
|
|
cb8e9e |
+ gf_msg ("timer", GF_LOG_ERROR, 0, LG_MSG_INIT_TIMER_FAILED,
|
|
|
cb8e9e |
+ "!reg");
|
|
|
cb8e9e |
GF_FREE (event);
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -145,13 +153,15 @@ gf_timer_proc (void *ctx)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (ctx == NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
reg = gf_timer_registry_init (ctx);
|
|
|
cb8e9e |
if (!reg) {
|
|
|
cb8e9e |
- gf_log ("timer", GF_LOG_ERROR, "!reg");
|
|
|
cb8e9e |
+ gf_msg ("timer", GF_LOG_ERROR, 0, LG_MSG_INIT_TIMER_FAILED,
|
|
|
cb8e9e |
+ "!reg");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -223,7 +233,8 @@ gf_timer_registry_t *
|
|
|
cb8e9e |
gf_timer_registry_init (glusterfs_ctx_t *ctx)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (ctx == NULL) {
|
|
|
cb8e9e |
- gf_log_callingfn ("timer", GF_LOG_ERROR, "invalid argument");
|
|
|
cb8e9e |
+ gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL,
|
|
|
cb8e9e |
+ LG_MSG_INVALID_ARG, "invalid argument");
|
|
|
cb8e9e |
return NULL;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|