From 2dcc68df252f9f8313eb8f8b2e1e97f539426643 Mon Sep 17 00:00:00 2001 From: Manikandan Selvaganesh Date: Mon, 6 Apr 2015 16:21:43 +0530 Subject: protocol/client : porting log messages to new framework Backport of http://review.gluster.org/#/c/10042/ Cherry picked from 379dbbfd683d2b0e1704c098b1f020567328122c > Change-Id: I9bf2ca08fef969e566a64475d0f7a16d37e66eeb > BUG: 1194640 > Signed-off-by: Manikandan Selvaganesh > Reviewed-on: http://review.gluster.org/10042 > Tested-by: Gluster Build System > Reviewed-by: Raghavendra G > Tested-by: Raghavendra G Change-Id: I9bf2ca08fef969e566a64475d0f7a16d37e66eeb BUG: 1217722 Signed-off-by: Manikandan Selvaganesh Reviewed-on: http://review.gluster.org/11240 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/protocol/client/src/client-lk.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'xlators/protocol/client/src/client-lk.c') diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c index b3c36a42021..0cf2be3c562 100644 --- a/xlators/protocol/client/src/client-lk.c +++ b/xlators/protocol/client/src/client-lk.c @@ -12,6 +12,7 @@ #include "xlator.h" #include "client.h" #include "lkowner.h" +#include "client-messages.h" static void __insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock); @@ -23,7 +24,7 @@ __dump_client_lock (client_posix_lock_t *lock) this = THIS; - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO, "{fd=%p}" "{%s lk-owner:%s %"PRId64" - %"PRId64"}" "{start=%"PRId64" end=%"PRId64"}", @@ -225,7 +226,8 @@ subtract_locks (client_posix_lock_t *big, client_posix_lock_t *small) } else { /* LOG-TODO : decide what more info is required here*/ - gf_log ("client-protocol", GF_LOG_CRITICAL, + gf_msg ("client-protocol", GF_LOG_CRITICAL, 0, + PC_MSG_LOCK_ERROR, "Unexpected case in subtract_locks. Please send " "a bug report to gluster-devel@gluster.org"); } @@ -363,8 +365,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner) this = THIS; fdctx = this_fd_get_ctx (fd, this); if (!fdctx) { - gf_log (this->name, GF_LOG_WARNING, - "fdctx not valid"); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_FD_CTX_INVALID, "fdctx not valid"); ret = -1; goto out; } @@ -387,8 +389,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner) } /* FIXME: Need to actually print the locks instead of count */ - gf_log (this->name, GF_LOG_TRACE, - "Number of locks cleared=%d", count); + gf_msg_trace (this->name, 0, + "Number of locks cleared=%d", count); out: return ret; @@ -421,8 +423,8 @@ delete_granted_locks_fd (clnt_fd_ctx_t *fdctx) } /* FIXME: Need to actually print the locks instead of count */ - gf_log (this->name, GF_LOG_TRACE, - "Number of locks cleared=%d", count); + gf_msg_trace (this->name, 0, + "Number of locks cleared=%d", count); return ret; } @@ -516,7 +518,7 @@ client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock, pthread_mutex_unlock (&conf->lock); if (!fdctx) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL, "failed to get fd context. sending EBADFD"); ret = -EBADFD; goto out; @@ -551,7 +553,8 @@ client_dump_locks (char *name, inode_t *inode, ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string); if (ret) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, + PC_MSG_DICT_SET_FAILED, "could not set dict with %s", CLIENT_DUMP_LOCKS); goto out; } -- cgit