cb8e9e
From 36027983e277235ad30a6c03f00ad8c8fe56bed9 Mon Sep 17 00:00:00 2001
cb8e9e
From: arao <arao@redhat.com>
cb8e9e
Date: Fri, 6 Mar 2015 12:33:05 +0530
cb8e9e
Subject: [PATCH 183/190] afr: Porting messages to new logging framework
cb8e9e
      updated
cb8e9e
cb8e9e
Change-Id: I71bacc6285242cd765c1c3c4fa8ba88f41e92b6a
cb8e9e
BUG: 1231779
cb8e9e
Signed-off-by: Anusha <arao@redhat.com>
cb8e9e
Reviewed-on: http://review.gluster.org/9897
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/51256
cb8e9e
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
cb8e9e
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
cb8e9e
---
cb8e9e
 xlators/cluster/afr/src/afr-common.c             |   64 +++--
cb8e9e
 xlators/cluster/afr/src/afr-inode-read.c         |   47 ++--
cb8e9e
 xlators/cluster/afr/src/afr-inode-write.c        |   14 +-
cb8e9e
 xlators/cluster/afr/src/afr-lk-common.c          |  115 ++++----
cb8e9e
 xlators/cluster/afr/src/afr-messages.h           |  193 ++++++++++++-
cb8e9e
 xlators/cluster/afr/src/afr-open.c               |   22 +-
cb8e9e
 xlators/cluster/afr/src/afr-read-txn.c           |   12 +-
cb8e9e
 xlators/cluster/afr/src/afr-self-heal-common.c   |   61 ++--
cb8e9e
 xlators/cluster/afr/src/afr-self-heal-data.c     |   22 +-
cb8e9e
 xlators/cluster/afr/src/afr-self-heal-entry.c    |   71 +++--
cb8e9e
 xlators/cluster/afr/src/afr-self-heal-metadata.c |   24 +-
cb8e9e
 xlators/cluster/afr/src/afr-self-heal-name.c     |   47 ++--
cb8e9e
 xlators/cluster/afr/src/afr-self-heald.c         |  107 ++++---
cb8e9e
 xlators/cluster/afr/src/afr-transaction.c        |   48 ++--
cb8e9e
 xlators/cluster/afr/src/afr.c                    |   34 ++-
cb8e9e
 xlators/cluster/afr/src/pump.c                   |  340 +++++++++++-----------
cb8e9e
 16 files changed, 748 insertions(+), 473 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
cb8e9e
index 9129b27..31c6eff 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-common.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-common.c
cb8e9e
@@ -972,7 +972,8 @@ afr_xattr_req_prepare (xlator_t *this, dict_t *xattr_req)
cb8e9e
                 ret = dict_set_uint64 (xattr_req, priv->pending_key[i],
cb8e9e
                                        AFR_NUM_CHANGE_LOGS * sizeof(int));
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                                -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "Unable to set dict value for %s",
cb8e9e
                                 priv->pending_key[i]);
cb8e9e
                 /* 3 = data+metadata+entry */
cb8e9e
@@ -980,14 +981,14 @@ afr_xattr_req_prepare (xlator_t *this, dict_t *xattr_req)
cb8e9e
         ret = dict_set_uint64 (xattr_req, AFR_DIRTY,
cb8e9e
 			       AFR_NUM_CHANGE_LOGS * sizeof(int));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "failed to set dirty "
cb8e9e
-                        "query flag");
cb8e9e
+                gf_msg_debug (this->name, -ret, "failed to set dirty "
cb8e9e
+                              "query flag");
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_set_int32 (xattr_req, "list-xattr", 1);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Unable to set list-xattr in dict ");
cb8e9e
+                gf_msg_debug (this->name, -ret,
cb8e9e
+                              "Unable to set list-xattr in dict ");
cb8e9e
         }
cb8e9e
 
cb8e9e
 	return ret;
cb8e9e
@@ -1009,27 +1010,26 @@ afr_lookup_xattr_req_prepare (afr_local_t *local, xlator_t *this,
cb8e9e
                 dict_copy (xattr_req, local->xattr_req);
cb8e9e
 
cb8e9e
         ret = afr_xattr_req_prepare (this, local->xattr_req);
cb8e9e
-	if (ret < 0) {
cb8e9e
-		gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-			"%s: Unable to prepare xattr_req", loc->path);
cb8e9e
-	}
cb8e9e
 
cb8e9e
         ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_INODELK_COUNT, 0);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                         "%s: Unable to set dict value for %s",
cb8e9e
                         loc->path, GLUSTERFS_INODELK_COUNT);
cb8e9e
         }
cb8e9e
         ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_ENTRYLK_COUNT, 0);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                         "%s: Unable to set dict value for %s",
cb8e9e
                         loc->path, GLUSTERFS_ENTRYLK_COUNT);
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_set_uint32 (local->xattr_req, GLUSTERFS_PARENT_ENTRYLK, 0);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                         "%s: Unable to set dict value for %s",
cb8e9e
                         loc->path, GLUSTERFS_PARENT_ENTRYLK);
cb8e9e
         }
cb8e9e
@@ -1740,9 +1740,10 @@ afr_local_discovery_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 if ((priv->arbiter_count == 1) &&
cb8e9e
                     (child_index == ARBITER_BRICK_INDEX))
cb8e9e
                         goto out;
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                        "selecting local read_child %s",
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        AFR_MSG_LOCAL_CHILD, "selecting local read_child %s",
cb8e9e
                         priv->children[child_index]->name);
cb8e9e
+
cb8e9e
                 priv->read_child = child_index;
cb8e9e
         }
cb8e9e
 out:
cb8e9e
@@ -2053,7 +2054,8 @@ afr_discover_done (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
 	read_subvol = afr_data_subvol_get (local->inode, this, 0, 0, NULL);
cb8e9e
 	if (read_subvol == -1) {
cb8e9e
-		gf_log (this->name, GF_LOG_WARNING, "no read subvols for %s",
cb8e9e
+	        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        AFR_MSG_READ_SUBVOL_ERROR, "no read subvols for %s",
cb8e9e
 			local->loc.path);
cb8e9e
 
cb8e9e
 		for (i = 0; i < priv->child_count; i++) {
cb8e9e
@@ -2492,8 +2494,8 @@ __afr_fd_ctx_set (xlator_t *this, fd_t *fd)
cb8e9e
 
cb8e9e
         ret = __fd_ctx_set (fd, this, (uint64_t)(long) fd_ctx);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "failed to set fd ctx (%p)", fd);
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "failed to set fd ctx (%p)", fd);
cb8e9e
 out:
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -2623,7 +2625,8 @@ afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd)
cb8e9e
         if (fd_ctx) {
cb8e9e
                 //no need to take any locks
cb8e9e
                 if (!list_empty (&fd_ctx->eager_locked))
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING, "%s: Stale "
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                AFR_MSG_INVALID_DATA, "%s: Stale "
cb8e9e
                                 "Eager-lock stubs found",
cb8e9e
                                 uuid_utoa (fd->inode->gfid));
cb8e9e
 
cb8e9e
@@ -3048,7 +3051,9 @@ afr_unlock_partial_inodelk_cbk (call_frame_t *frame, void *cookie,
cb8e9e
 
cb8e9e
         if (op_ret < 0 && op_errno != ENOTCONN) {
cb8e9e
                 loc_gfid (&local->loc, gfid);
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "%s: Failed to unlock %s "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INODE_UNLOCK_FAIL,
cb8e9e
+                        "%s: Failed to unlock %s "
cb8e9e
                         "with lk_owner: %s (%s)", uuid_utoa (gfid),
cb8e9e
                         priv->children[child_index]->name,
cb8e9e
                         lkowner_utoa (&frame->root->lk_owner),
cb8e9e
@@ -4122,7 +4127,8 @@ afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno)
cb8e9e
                 sizeof (*local->child_up) * priv->child_count);
cb8e9e
         local->call_count = AFR_COUNT (local->child_up, priv->child_count);
cb8e9e
         if (local->call_count == 0) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_INFO, "no subvolumes up");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_INFO, 0,
cb8e9e
+                        AFR_MSG_ALL_SUBVOLS_DOWN, "no subvolumes up");
cb8e9e
                 if (op_errno)
cb8e9e
                         *op_errno = ENOTCONN;
cb8e9e
                 goto out;
cb8e9e
@@ -4680,20 +4686,23 @@ afr_set_heal_info (char *status)
cb8e9e
         if (!strcmp (status, "heal")) {
cb8e9e
                 ret = dict_set_str (dict, "heal-info", "heal");
cb8e9e
                 if (ret)
cb8e9e
-                        gf_log ("", GF_LOG_WARNING,
cb8e9e
-                                "Failed to set heal-info key to"
cb8e9e
+                        gf_msg ("", GF_LOG_WARNING, -ret,
cb8e9e
+                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "Failed to set heal-info key to "
cb8e9e
                                 "heal");
cb8e9e
         } else if (!strcmp (status, "split-brain")) {
cb8e9e
                 ret = dict_set_str (dict, "heal-info", "split-brain");
cb8e9e
                 if (ret)
cb8e9e
-                        gf_log ("", GF_LOG_WARNING,
cb8e9e
-                                "Failed to set heal-info key to"
cb8e9e
+                        gf_msg ("", GF_LOG_WARNING, -ret,
cb8e9e
+                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "Failed to set heal-info key to "
cb8e9e
                                 "split-brain");
cb8e9e
         } else if (!strcmp (status, "possibly-healing")) {
cb8e9e
                 ret = dict_set_str (dict, "heal-info", "possibly-healing");
cb8e9e
                 if (ret)
cb8e9e
-                       gf_log ("", GF_LOG_WARNING,
cb8e9e
-                                "Failed to set heal-info key to"
cb8e9e
+                        gf_msg ("", GF_LOG_WARNING, -ret,
cb8e9e
+                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "Failed to set heal-info key to "
cb8e9e
                                 "possibly-healing");
cb8e9e
         }
cb8e9e
 out:
cb8e9e
@@ -4932,7 +4941,8 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc)
cb8e9e
                 ret = dict_set_str (dict, "sh-fail-msg",
cb8e9e
                                     "File not in split-brain");
cb8e9e
                 if (ret)
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                                -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "Failed to set sh-fail-msg in dict");
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c
cb8e9e
index 7fed62a..1ebe5e5 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-inode-read.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-inode-read.c
cb8e9e
@@ -38,6 +38,7 @@
cb8e9e
 #include "quota-common-utils.h"
cb8e9e
 
cb8e9e
 #include "afr-transaction.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 /*
cb8e9e
  * Quota size xattrs are not maintained by afr. There is a
cb8e9e
@@ -594,8 +595,6 @@ unlock:
cb8e9e
                 if (ret) {
cb8e9e
                         op_ret = -1;
cb8e9e
                         op_errno = ENOMEM;
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Error serializing dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
                 if (serz_len == -1)
cb8e9e
@@ -606,7 +605,8 @@ unlock:
cb8e9e
                 if (ret) {
cb8e9e
                         op_ret = -1;
cb8e9e
                         op_errno = ENOMEM;
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                ENOMEM, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "Error setting dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
@@ -682,8 +682,6 @@ unlock:
cb8e9e
                 if (ret) {
cb8e9e
                         op_ret = -1;
cb8e9e
                         op_errno = ENOMEM;
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Error serializing dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
                 if (serz_len == -1)
cb8e9e
@@ -694,7 +692,8 @@ unlock:
cb8e9e
                 if (ret) {
cb8e9e
                         op_ret = -1;
cb8e9e
                         op_errno = ENOMEM;
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                ENOMEM, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "Error setting dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
@@ -1047,7 +1046,8 @@ afr_fgetxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
cb8e9e
         int32_t      tlen           = 0;
cb8e9e
 
cb8e9e
         if (!frame || !frame->local || !this) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "possible NULL deref");
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INVALID_ARG, "possible NULL deref");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1086,7 +1086,8 @@ afr_fgetxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
cb8e9e
                         ret = dict_set_dynstr (local->dict,
cb8e9e
                                                xattr_cky, xattr);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                         "Cannot set xattr cookie key");
cb8e9e
                                 goto unlock;
cb8e9e
                         }
cb8e9e
@@ -1127,8 +1128,6 @@ unlock:
cb8e9e
                                                        + strlen (xattr_serz),
cb8e9e
                                                        &tlen, ' ');
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Error serializing"
cb8e9e
-                                " dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
 
cb8e9e
@@ -1139,8 +1138,9 @@ unlock:
cb8e9e
                 ret = dict_set_dynstr (nxattr, local->cont.getxattr.name,
cb8e9e
                                        xattr_serz);
cb8e9e
                 if (ret)
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Cannot set pathinfo"
cb8e9e
-                                " key in dict");
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "Cannot set pathinfo key in dict");
cb8e9e
 
cb8e9e
         unwind:
cb8e9e
                 AFR_STACK_UNWIND (fgetxattr, frame, local->op_ret,
cb8e9e
@@ -1171,7 +1171,8 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
cb8e9e
         int32_t      tlen           = 0;
cb8e9e
 
cb8e9e
         if (!frame || !frame->local || !this) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "possible NULL deref");
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INVALID_ARG, "possible NULL deref");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1210,8 +1211,11 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
cb8e9e
                                 ret = dict_set_dynstr (local->dict,
cb8e9e
                                                        xattr_cky, xattr);
cb8e9e
                                 if (ret) {
cb8e9e
-                                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                                "Cannot set xattr cookie key");
cb8e9e
+                                        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                                -ret,
cb8e9e
+                                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                                "Cannot set xattr "
cb8e9e
+                                                "cookie key");
cb8e9e
                                         goto unlock;
cb8e9e
                                 }
cb8e9e
 
cb8e9e
@@ -1248,8 +1252,6 @@ unlock:
cb8e9e
                                                        xattr_serz + strlen (xattr_serz),
cb8e9e
                                                        &tlen, ' ');
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Error serializing"
cb8e9e
-                                " dictionary");
cb8e9e
                         goto unwind;
cb8e9e
                 }
cb8e9e
 
cb8e9e
@@ -1260,8 +1262,9 @@ unlock:
cb8e9e
                 ret = dict_set_dynstr (nxattr, local->cont.getxattr.name,
cb8e9e
                                        xattr_serz);
cb8e9e
                 if (ret)
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Cannot set pathinfo"
cb8e9e
-                                " key in dict");
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "Cannot set pathinfo key in dict");
cb8e9e
 
cb8e9e
         unwind:
cb8e9e
                 AFR_STACK_UNWIND (getxattr, frame, local->op_ret,
cb8e9e
@@ -1295,7 +1298,8 @@ afr_common_getxattr_stime_cbk (call_frame_t *frame, void *cookie,
cb8e9e
         int32_t      callcnt        = 0;
cb8e9e
 
cb8e9e
         if (!frame || !frame->local || !this) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "possible NULL deref");
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INVALID_ARG, "possible NULL deref");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1465,9 +1469,6 @@ afr_getxattr (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
         if (!strncmp (name, AFR_XATTR_PREFIX,
cb8e9e
                       strlen (AFR_XATTR_PREFIX))) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                        "%s: no data present for key %s",
cb8e9e
-                        loc->path, name);
cb8e9e
                 op_errno = ENODATA;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
cb8e9e
index 8800b81..be83781 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-inode-write.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-inode-write.c
cb8e9e
@@ -1186,7 +1186,8 @@ afr_split_brain_resolve_do (call_frame_t *frame, xlator_t *this, loc_t *loc,
cb8e9e
          */
cb8e9e
         ret = afr_inode_split_brain_choice_set (loc->inode, this, -1);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "Failed to set"
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR, "Failed to set"
cb8e9e
                         "split-brain choice to -1");
cb8e9e
         afr_heal_splitbrain_file (frame, this, loc);
cb8e9e
         ret = 0;
cb8e9e
@@ -1211,7 +1212,8 @@ afr_get_split_brain_child_index (xlator_t *this, void *value, size_t len)
cb8e9e
         spb_child_index = afr_get_child_index_from_name (this,
cb8e9e
                                                          spb_child_str);
cb8e9e
         if (spb_child_index < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Invalid subvol: %s",
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INVALID_SUBVOL, "Invalid subvol: %s",
cb8e9e
                         spb_child_str);
cb8e9e
         }
cb8e9e
         return spb_child_index;
cb8e9e
@@ -1234,7 +1236,9 @@ afr_can_set_split_brain_choice (void *opaque)
cb8e9e
                                   &data->d_spb, &data->m_spb);
cb8e9e
 
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to determine if %s"
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR,
cb8e9e
+                        "Failed to determine if %s"
cb8e9e
                         " is in split-brain. "
cb8e9e
                         "Aborting split-brain-choice set.",
cb8e9e
                         uuid_utoa (loc->gfid));
cb8e9e
@@ -1292,7 +1296,9 @@ afr_handle_split_brain_commands (xlator_t *this, call_frame_t *frame,
cb8e9e
                                     afr_can_set_split_brain_choice,
cb8e9e
                                     afr_set_split_brain_choice, NULL, data);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Failed to create"
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR,
cb8e9e
+                                "Failed to create"
cb8e9e
                                 " synctask. Aborting split-brain choice set"
cb8e9e
                                 " for %s", loc->name);
cb8e9e
                         ret = 1;
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
cb8e9e
index dc4dfbc..8175a21 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-lk-common.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-lk-common.c
cb8e9e
@@ -14,6 +14,7 @@
cb8e9e
 
cb8e9e
 #include "afr.h"
cb8e9e
 #include "afr-transaction.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 #include <signal.h>
cb8e9e
 
cb8e9e
@@ -111,9 +112,9 @@ afr_set_lock_number (call_frame_t *frame, xlator_t *this)
cb8e9e
 void
cb8e9e
 afr_set_lk_owner (call_frame_t *frame, xlator_t *this, void *lk_owner)
cb8e9e
 {
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                "Setting lk-owner=%llu",
cb8e9e
-                (unsigned long long) (unsigned long)lk_owner);
cb8e9e
+        gf_msg_trace (this->name, 0,
cb8e9e
+                      "Setting lk-owner=%llu",
cb8e9e
+                      (unsigned long long) (unsigned long)lk_owner);
cb8e9e
 
cb8e9e
         set_lk_owner_from_ptr (&frame->root->lk_owner, lk_owner);
cb8e9e
 }
cb8e9e
@@ -308,7 +309,7 @@ afr_trace_inodelk_out (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
         afr_print_verdict (op_ret, op_errno, verdict);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
cb8e9e
                 "[%s %s] [%s] lk-owner=%s Lockee={%s} Number={%llu}",
cb8e9e
                 lock_call_type_str,
cb8e9e
                 lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
cb8e9e
@@ -338,7 +339,7 @@ afr_trace_inodelk_in (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
         afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
cb8e9e
                 "[%s %s] Lock={%s} Lockee={%s} Number={%llu}",
cb8e9e
                 lock_call_type_str,
cb8e9e
                 lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
cb8e9e
@@ -379,7 +380,7 @@ afr_trace_entrylk_in (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
         afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
cb8e9e
                 "[%s %s] Lock={%s} Lockee={%s} Number={%llu}, Cookie={%d}",
cb8e9e
                 lock_call_type_str,
cb8e9e
                 lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
cb8e9e
@@ -423,7 +424,7 @@ afr_trace_entrylk_out (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
         afr_print_verdict (op_ret, op_errno, verdict);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
cb8e9e
                 "[%s %s] [%s] Lock={%s} Lockee={%s} Number={%llu} Cookie={%d}",
cb8e9e
                 lock_call_type_str,
cb8e9e
                 lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
cb8e9e
@@ -443,20 +444,20 @@ transaction_lk_op (afr_local_t *local)
cb8e9e
         int_lock = &local->internal_lock;
cb8e9e
 
cb8e9e
         if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_DEBUG,
cb8e9e
-                        "lk op is for a transaction");
cb8e9e
+                gf_msg_debug (THIS->name, 0,
cb8e9e
+                              "lk op is for a transaction");
cb8e9e
                 ret = 1;
cb8e9e
         }
cb8e9e
         else if (int_lock->transaction_lk_type == AFR_SELFHEAL_LK) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_DEBUG,
cb8e9e
-                        "lk op is for a self heal");
cb8e9e
+                gf_msg_debug (THIS->name, 0,
cb8e9e
+                              "lk op is for a self heal");
cb8e9e
 
cb8e9e
                 ret = 0;
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (ret == -1)
cb8e9e
-                gf_log (THIS->name, GF_LOG_DEBUG,
cb8e9e
-                        "lk op is not set");
cb8e9e
+                gf_msg_debug (THIS->name, 0,
cb8e9e
+                              "lk op is not set");
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 
cb8e9e
@@ -626,8 +627,9 @@ afr_unlock_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         UNLOCK (&frame->lock);
cb8e9e
 
cb8e9e
         if (call_count == 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "All internal locks unlocked");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "All internal locks unlocked");
cb8e9e
+
cb8e9e
                 int_lock->lock_cbk (frame, this);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -708,8 +710,9 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
cb8e9e
         int_lock->lk_call_count = call_count;
cb8e9e
 
cb8e9e
         if (!call_count) {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "No internal locks unlocked");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "No internal locks unlocked");
cb8e9e
+
cb8e9e
                 int_lock->lock_cbk (frame, this);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -842,8 +845,8 @@ afr_unlock_entrylk (call_frame_t *frame, xlator_t *this)
cb8e9e
         int_lock->lk_call_count = call_count;
cb8e9e
 
cb8e9e
         if (!call_count){
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "No internal locks unlocked");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "No internal locks unlocked");
cb8e9e
                 int_lock->lock_cbk (frame, this);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -899,7 +902,8 @@ afr_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 if (op_ret == -1) {
cb8e9e
                         if (op_errno == ENOSYS) {
cb8e9e
                                 /* return ENOTSUP */
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, ENOSYS,
cb8e9e
+                                        AFR_MSG_LOCK_XLATOR_NOT_LOADED,
cb8e9e
                                         "subvolume does not support locking. "
cb8e9e
                                         "please load features/locks xlator on server");
cb8e9e
                                 local->op_ret = op_ret;
cb8e9e
@@ -1058,7 +1062,8 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
cb8e9e
                 ret = fd_ctx_get (local->fd, this, &ctx;;
cb8e9e
 
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_FD_CTX_GET_FAILED,
cb8e9e
                                 "unable to get fd ctx for fd=%p",
cb8e9e
                                 local->fd);
cb8e9e
 
cb8e9e
@@ -1076,7 +1081,8 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
cb8e9e
         if (int_lock->lk_expected_count == int_lock->lk_attempted_count) {
cb8e9e
                 if ((is_entrylk && int_lock->entrylk_lock_count == 0) ||
cb8e9e
                     (!is_entrylk && int_lock->lock_count == 0)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_BLOCKING_LKS_FAILED,
cb8e9e
                                 "unable to lock on even one child");
cb8e9e
 
cb8e9e
                         local->op_ret           = -1;
cb8e9e
@@ -1093,8 +1099,8 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
cb8e9e
         if (int_lock->lk_expected_count == int_lock->lk_attempted_count) {
cb8e9e
                 /* we're done locking */
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "we're done locking");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "we're done locking");
cb8e9e
 
cb8e9e
                 afr_copy_locked_nodes (frame, this);
cb8e9e
 
cb8e9e
@@ -1246,9 +1252,11 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 		if (op_ret < 0 ) {
cb8e9e
 			if (op_errno == ENOSYS) {
cb8e9e
                         /* return ENOTSUP */
cb8e9e
-				gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-					"subvolume does not support locking. "
cb8e9e
-					"please load features/locks xlator on server");
cb8e9e
+			        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                        ENOSYS, AFR_MSG_LOCK_XLATOR_NOT_LOADED,
cb8e9e
+                                        "subvolume does not support "
cb8e9e
+                                        "locking. please load features/locks"
cb8e9e
+                                        " xlator on server");
cb8e9e
 				local->op_ret         = op_ret;
cb8e9e
 				int_lock->lock_op_ret = op_ret;
cb8e9e
 
cb8e9e
@@ -1267,22 +1275,23 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         UNLOCK (&frame->lock);
cb8e9e
 
cb8e9e
         if (call_count == 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "Last locking reply received");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "Last locking reply received");
cb8e9e
                 /* all locks successful. Proceed to call FOP */
cb8e9e
                 if (int_lock->entrylk_lock_count ==
cb8e9e
                                 int_lock->lk_expected_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                "All servers locked. Calling the cbk");
cb8e9e
+                        gf_msg_trace (this->name, 0,
cb8e9e
+                                      "All servers locked. Calling the cbk");
cb8e9e
                         int_lock->lock_op_ret = 0;
cb8e9e
                         int_lock->lock_cbk (frame, this);
cb8e9e
                 }
cb8e9e
                 /* Not all locks were successful. Unlock and try locking
cb8e9e
                    again, this time with serially blocking locks */
cb8e9e
                 else {
cb8e9e
-                        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                "%d servers locked. Trying again with blocking calls",
cb8e9e
-                                int_lock->lock_count);
cb8e9e
+                        gf_msg_trace (this->name, 0,
cb8e9e
+                                      "%d servers locked. Trying again "
cb8e9e
+                                      "with blocking calls",
cb8e9e
+                                      int_lock->lock_count);
cb8e9e
 
cb8e9e
                         afr_unlock(frame, this);
cb8e9e
                 }
cb8e9e
@@ -1314,7 +1323,8 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
cb8e9e
         if (local->fd) {
cb8e9e
                 fd_ctx = afr_fd_ctx_get (local->fd, this);
cb8e9e
                 if (!fd_ctx) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_FD_CTX_GET_FAILED,
cb8e9e
                                 "unable to get fd ctx for fd=%p",
cb8e9e
                                 local->fd);
cb8e9e
 
cb8e9e
@@ -1332,7 +1342,8 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
cb8e9e
                 int_lock->lk_expected_count = call_count;
cb8e9e
 
cb8e9e
                 if (!call_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_INFO_COMMON,
cb8e9e
                                 "fd not open on any subvolumes. aborting.");
cb8e9e
                         afr_unlock (frame, this);
cb8e9e
                         goto out;
cb8e9e
@@ -1421,10 +1432,11 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 		if (op_ret < 0) {
cb8e9e
 			if (op_errno == ENOSYS) {
cb8e9e
 				/* return ENOTSUP */
cb8e9e
-				gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-					"subvolume does not support locking. "
cb8e9e
-					"please load features/locks xlator on "
cb8e9e
-					"server");
cb8e9e
+		                gf_msg (this->name, GF_LOG_ERROR, ENOSYS,
cb8e9e
+                                        AFR_MSG_LOCK_XLATOR_NOT_LOADED,
cb8e9e
+					"subvolume does not support "
cb8e9e
+                                        "locking. please load features/locks"
cb8e9e
+                                        " xlator on server");
cb8e9e
 				local->op_ret                = op_ret;
cb8e9e
 				int_lock->lock_op_ret        = op_ret;
cb8e9e
 				int_lock->lock_op_errno      = op_errno;
cb8e9e
@@ -1454,21 +1466,22 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         UNLOCK (&frame->lock);
cb8e9e
 
cb8e9e
         if (call_count == 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "Last inode locking reply received");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "Last inode locking reply received");
cb8e9e
                 /* all locks successful. Proceed to call FOP */
cb8e9e
                 if (inodelk->lock_count == int_lock->lk_expected_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                "All servers locked. Calling the cbk");
cb8e9e
+                        gf_msg_trace (this->name, 0,
cb8e9e
+                                      "All servers locked. Calling the cbk");
cb8e9e
                         int_lock->lock_op_ret = 0;
cb8e9e
                         int_lock->lock_cbk (frame, this);
cb8e9e
                 }
cb8e9e
                 /* Not all locks were successful. Unlock and try locking
cb8e9e
                    again, this time with serially blocking locks */
cb8e9e
                 else {
cb8e9e
-                        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                "%d servers locked. Trying again with blocking calls",
cb8e9e
-                                int_lock->lock_count);
cb8e9e
+                        gf_msg_trace (this->name, 0,
cb8e9e
+                                      "%d servers locked. "
cb8e9e
+                                      "Trying again with blocking calls",
cb8e9e
+                                      int_lock->lock_count);
cb8e9e
 
cb8e9e
                         afr_unlock(frame, this);
cb8e9e
                 }
cb8e9e
@@ -1510,7 +1523,8 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
cb8e9e
         if (local->fd) {
cb8e9e
                 fd_ctx = afr_fd_ctx_get (local->fd, this);
cb8e9e
                 if (!fd_ctx) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_FD_CTX_GET_FAILED,
cb8e9e
                                 "unable to get fd ctx for fd=%p",
cb8e9e
                                 local->fd);
cb8e9e
 
cb8e9e
@@ -1529,8 +1543,9 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
cb8e9e
                 int_lock->lk_expected_count = call_count;
cb8e9e
 
cb8e9e
                 if (!call_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                                "fd not open on any subvolumes. aborting.");
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_ALL_SUBVOLS_DOWN,
cb8e9e
+                                "All bricks are down, aborting.");
cb8e9e
                         afr_unlock (frame, this);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-messages.h b/xlators/cluster/afr/src/afr-messages.h
cb8e9e
index 66b8ed1..e4bf85b 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-messages.h
cb8e9e
+++ b/xlators/cluster/afr/src/afr-messages.h
cb8e9e
@@ -1,5 +1,5 @@
cb8e9e
 /*
cb8e9e
- Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
cb8e9e
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
cb8e9e
  This file is part of GlusterFS.
cb8e9e
 
cb8e9e
  This file is licensed to you under your choice of the GNU Lesser
cb8e9e
@@ -44,9 +44,9 @@
cb8e9e
  * holes.
cb8e9e
  */
cb8e9e
 
cb8e9e
-#define GLFS_COMP_BASE_AFR GLFS_MSGID_COMP_AFR
cb8e9e
-#define GLFS_NUM_MESSAGES 11
cb8e9e
-#define GLFS_MSGID_END (GLFS_COMP_BASE_AFR + GLFS_NUM_MESSAGES + 1)
cb8e9e
+#define GLFS_COMP_BASE_AFR      GLFS_MSGID_COMP_AFR
cb8e9e
+#define GLFS_NUM_MESSAGES       37
cb8e9e
+#define GLFS_MSGID_END          (GLFS_COMP_BASE_AFR + GLFS_NUM_MESSAGES + 1)
cb8e9e
 
cb8e9e
 #define glfs_msg_start_x GLFS_COMP_BASE_AFR, "Invalid: Start of messages"
cb8e9e
 
cb8e9e
@@ -141,7 +141,6 @@
cb8e9e
 */
cb8e9e
 #define AFR_MSG_INODE_UNLOCK_FAIL       (GLFS_COMP_BASE_AFR + 10)
cb8e9e
 
cb8e9e
-
cb8e9e
 /*!
cb8e9e
  * @messageid 108011
cb8e9e
  * @diagnosis Setting of pending xattrs succeeded/failed during replace-brick
cb8e9e
@@ -151,7 +150,189 @@
cb8e9e
 */
cb8e9e
 #define AFR_MSG_REPLACE_BRICK_STATUS     (GLFS_COMP_BASE_AFR + 11)
cb8e9e
 
cb8e9e
+/*!
cb8e9e
+ * @messageid 108012
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_GFID_NULL                       (GLFS_COMP_BASE_AFR + 12)
cb8e9e
 
cb8e9e
-#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
cb8e9e
+/*!
cb8e9e
+ * @messageid 108013
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_FD_CREATE_FAILED                (GLFS_COMP_BASE_AFR + 13)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108014
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_DICT_SET_FAILED                 (GLFS_COMP_BASE_AFR + 14)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108015
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_EXPUNGING_FILE_OR_DIR           (GLFS_COMP_BASE_AFR + 15)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108016
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_MIGRATION_IN_PROGRESS           (GLFS_COMP_BASE_AFR + 16)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108017
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_CHILD_MISCONFIGURED             (GLFS_COMP_BASE_AFR + 17)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108018
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_VOL_MISCONFIGURED               (GLFS_COMP_BASE_AFR + 18)
cb8e9e
 
cb8e9e
+/*!
cb8e9e
+ * @messageid 108019
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_BLOCKING_LKS_FAILED             (GLFS_COMP_BASE_AFR + 19)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108020
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INVALID_FD                      (GLFS_COMP_BASE_AFR + 20)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108021
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_LOCK_INFO                       (GLFS_COMP_BASE_AFR + 21)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108022
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_LOCK_XLATOR_NOT_LOADED          (GLFS_COMP_BASE_AFR + 22)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108023
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_FD_CTX_GET_FAILED               (GLFS_COMP_BASE_AFR + 23)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108024
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INVALID_SUBVOL                    (GLFS_COMP_BASE_AFR + 24)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108025
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_PUMP_XLATOR_ERROR               (GLFS_COMP_BASE_AFR + 25)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108026
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_SELF_HEAL_INFO                  (GLFS_COMP_BASE_AFR + 26)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108027
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_READ_SUBVOL_ERROR               (GLFS_COMP_BASE_AFR + 27)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108028
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_DICT_GET_FAILED                 (GLFS_COMP_BASE_AFR + 28)
cb8e9e
+
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108029
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INFO_COMMON                     (GLFS_COMP_BASE_AFR + 29)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108030
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR         (GLFS_COMP_BASE_AFR + 30)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108031
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_LOCAL_CHILD         (GLFS_COMP_BASE_AFR + 31)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108032
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INVALID_DATA         (GLFS_COMP_BASE_AFR + 32)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108033
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INVALID_ARG         (GLFS_COMP_BASE_AFR + 33)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108034
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_INDEX_DIR_GET_FAILED         (GLFS_COMP_BASE_AFR + 34)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108035
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_FSYNC_FAILED         (GLFS_COMP_BASE_AFR + 35)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid 108036
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_FAVORITE_CHILD         (GLFS_COMP_BASE_AFR + 36)
cb8e9e
+/*!
cb8e9e
+ * @messageid 108037
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+*/
cb8e9e
+#define AFR_MSG_SELF_HEAL_FAILED                (GLFS_COMP_BASE_AFR + 37)
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
cb8e9e
 #endif /* !_AFR_MESSAGES_H_ */
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
cb8e9e
index f1da8b0..9c90544 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-open.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-open.c
cb8e9e
@@ -182,9 +182,9 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         local    = frame->local;
cb8e9e
 
cb8e9e
         if (op_ret >= 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "fd for %s opened "
cb8e9e
-                        "successfully on subvolume %s", local->loc.path,
cb8e9e
-                        priv->children[child_index]->name);
cb8e9e
+                gf_msg_debug (this->name, 0, "fd for %s opened "
cb8e9e
+                              "successfully on subvolume %s", local->loc.path,
cb8e9e
+                              priv->children[child_index]->name);
cb8e9e
         } else {
cb8e9e
                 gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
cb8e9e
                         op_errno, AFR_MSG_OPEN_FAIL, "Failed to open %s on "
cb8e9e
@@ -291,17 +291,17 @@ afr_fix_open (fd_t *fd, xlator_t *this)
cb8e9e
 
cb8e9e
         local->call_count = call_count;
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "need open count: %d",
cb8e9e
-                call_count);
cb8e9e
+        gf_msg_debug (this->name, 0, "need open count: %d",
cb8e9e
+                      call_count);
cb8e9e
 
cb8e9e
         for (i = 0; i < priv->child_count; i++) {
cb8e9e
                 if (!need_open[i])
cb8e9e
                         continue;
cb8e9e
 
cb8e9e
                 if (IA_IFDIR == fd->inode->ia_type) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "opening fd for dir %s on subvolume %s",
cb8e9e
-                                local->loc.path, priv->children[i]->name);
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "opening fd for dir %s on subvolume %s",
cb8e9e
+                                      local->loc.path, priv->children[i]->name);
cb8e9e
 
cb8e9e
                         STACK_WIND_COOKIE (frame, afr_openfd_fix_open_cbk,
cb8e9e
                                            (void*) (long) i,
cb8e9e
@@ -310,9 +310,9 @@ afr_fix_open (fd_t *fd, xlator_t *this)
cb8e9e
                                            &local->loc, local->fd,
cb8e9e
                                            NULL);
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "opening fd for file %s on subvolume %s",
cb8e9e
-                                local->loc.path, priv->children[i]->name);
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "opening fd for file %s on subvolume %s",
cb8e9e
+                                      local->loc.path, priv->children[i]->name);
cb8e9e
 
cb8e9e
                         STACK_WIND_COOKIE (frame, afr_openfd_fix_open_cbk,
cb8e9e
                                            (void *)(long) i,
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-read-txn.c b/xlators/cluster/afr/src/afr-read-txn.c
cb8e9e
index 6e54549..a998cce 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-read-txn.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-read-txn.c
cb8e9e
@@ -10,6 +10,7 @@
cb8e9e
 
cb8e9e
 #include "afr.h"
cb8e9e
 #include "afr-transaction.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 int
cb8e9e
 afr_read_txn_next_subvol (call_frame_t *frame, xlator_t *this)
cb8e9e
@@ -216,9 +217,9 @@ afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
cb8e9e
 		/* very first transaction on this inode */
cb8e9e
 		goto refresh;
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "%s: generation now vs cached: %d, "
cb8e9e
-                "%d", uuid_utoa (inode->gfid), local->event_generation,
cb8e9e
-                event_generation);
cb8e9e
+        gf_msg_debug (this->name, 0, "%s: generation now vs cached: %d, "
cb8e9e
+                      "%d", uuid_utoa (inode->gfid), local->event_generation,
cb8e9e
+                      event_generation);
cb8e9e
 	if (local->event_generation != event_generation)
cb8e9e
 		/* servers have disconnected / reconnected, and possibly
cb8e9e
 		   rebooted, very likely changing the state of freshness
cb8e9e
@@ -229,7 +230,7 @@ afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
cb8e9e
 							local->readable, NULL);
cb8e9e
 
cb8e9e
 	if (read_subvol < 0 || read_subvol > priv->child_count) {
cb8e9e
-		gf_msg (this->name, GF_LOG_WARNING, 0, AFR_MSG_SPLIT_BRAIN,
cb8e9e
+	        gf_msg (this->name, GF_LOG_WARNING, 0, AFR_MSG_SPLIT_BRAIN,
cb8e9e
                        "Unreadable subvolume %d found with event generation "
cb8e9e
                        "%d for gfid %s. (Possible split-brain)",
cb8e9e
                         read_subvol, event_generation, uuid_utoa(inode->gfid));
cb8e9e
@@ -238,7 +239,8 @@ afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
cb8e9e
 
cb8e9e
 	if (!local->child_up[read_subvol]) {
cb8e9e
 		/* should never happen, just in case */
cb8e9e
-		gf_log (this->name, GF_LOG_WARNING, "subvolume %d is the "
cb8e9e
+	        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        AFR_MSG_READ_SUBVOL_ERROR, "subvolume %d is the "
cb8e9e
 			"read subvolume in this generation, but is not up",
cb8e9e
 			read_subvol);
cb8e9e
 		goto refresh;
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
cb8e9e
index 1e46226..c9010df 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
cb8e9e
@@ -18,6 +18,7 @@
cb8e9e
 #include "afr-self-heal.h"
cb8e9e
 #include "byte-order.h"
cb8e9e
 #include "protocol-common.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 int
cb8e9e
 afr_selfheal_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
@@ -167,8 +168,6 @@ afr_selfheal_undo_pending (call_frame_t *frame, xlator_t *this, inode_t *inode,
cb8e9e
 		xattr = afr_selfheal_output_xattr (this, type, output_dirty,
cb8e9e
 						   output_matrix, i);
cb8e9e
 		if (!xattr) {
cb8e9e
-			gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-				"unable to allocate xdata for subvol %d", i);
cb8e9e
 			continue;
cb8e9e
 		}
cb8e9e
 
cb8e9e
@@ -646,7 +645,8 @@ afr_log_selfheal (uuid_t gfid, xlator_t *this, int ret, char *type,
cb8e9e
                 loglevel = GF_LOG_INFO;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, loglevel, "%s %s selfheal on %s. "
cb8e9e
+        gf_msg (this->name, loglevel, 0,
cb8e9e
+                AFR_MSG_SELF_HEAL_INFO, "%s %s selfheal on %s. "
cb8e9e
                 "source=%d sinks=%s", status, type, uuid_utoa (gfid),
cb8e9e
                 source, sinks_str);
cb8e9e
 }
cb8e9e
@@ -1124,7 +1124,7 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
cb8e9e
 		}
cb8e9e
 
cb8e9e
 		if (!IA_EQUAL (first, replies[i].poststat, type)) {
cb8e9e
-			gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+		        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
                                 AFR_MSG_SPLIT_BRAIN,
cb8e9e
 				"TYPE mismatch %d vs %d on %s for gfid:%s",
cb8e9e
 				(int) first.ia_type,
cb8e9e
@@ -1136,36 +1136,40 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
cb8e9e
 		}
cb8e9e
 
cb8e9e
 		if (!IA_EQUAL (first, replies[i].poststat, uid)) {
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"UID mismatch %d vs %d on %s for gfid:%s",
cb8e9e
-				(int) first.ia_uid,
cb8e9e
-				(int) replies[i].poststat.ia_uid,
cb8e9e
-				priv->children[i]->name,
cb8e9e
-				uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+				      "UID mismatch "
cb8e9e
+                                      "%d vs %d on %s for gfid:%s",
cb8e9e
+				      (int) first.ia_uid,
cb8e9e
+				      (int) replies[i].poststat.ia_uid,
cb8e9e
+				      priv->children[i]->name,
cb8e9e
+				      uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
 
cb8e9e
                         if (metadata_selfheal)
cb8e9e
                                 *metadata_selfheal = _gf_true;
cb8e9e
 		}
cb8e9e
 
cb8e9e
 		if (!IA_EQUAL (first, replies[i].poststat, gid)) {
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"GID mismatch %d vs %d on %s for gfid:%s",
cb8e9e
-				(int) first.ia_uid,
cb8e9e
-				(int) replies[i].poststat.ia_uid,
cb8e9e
-				priv->children[i]->name,
cb8e9e
-				uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+				      "GID mismatch "
cb8e9e
+                                      "%d vs %d on %s for gfid:%s",
cb8e9e
+				      (int) first.ia_uid,
cb8e9e
+				      (int) replies[i].poststat.ia_uid,
cb8e9e
+				      priv->children[i]->name,
cb8e9e
+				      uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
 
cb8e9e
                         if (metadata_selfheal)
cb8e9e
                                 *metadata_selfheal = _gf_true;
cb8e9e
 		}
cb8e9e
 
cb8e9e
 		if (!IA_EQUAL (first, replies[i].poststat, prot)) {
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"MODE mismatch %d vs %d on %s for gfid:%s",
cb8e9e
-				(int) st_mode_from_ia (first.ia_prot, 0),
cb8e9e
-				(int) st_mode_from_ia (replies[i].poststat.ia_prot, 0),
cb8e9e
-				priv->children[i]->name,
cb8e9e
-				uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+			              "MODE mismatch "
cb8e9e
+                                      "%d vs %d on %s for gfid:%s",
cb8e9e
+				      (int) st_mode_from_ia (first.ia_prot, 0),
cb8e9e
+				      (int) st_mode_from_ia
cb8e9e
+                                      (replies[i].poststat.ia_prot, 0),
cb8e9e
+				      priv->children[i]->name,
cb8e9e
+				      uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
 
cb8e9e
                         if (metadata_selfheal)
cb8e9e
                                 *metadata_selfheal = _gf_true;
cb8e9e
@@ -1173,12 +1177,13 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
cb8e9e
 
cb8e9e
 		if (IA_ISREG(first.ia_type) &&
cb8e9e
 		    !IA_EQUAL (first, replies[i].poststat, size)) {
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"SIZE mismatch %lld vs %lld on %s for gfid:%s",
cb8e9e
-				(long long) first.ia_size,
cb8e9e
-				(long long) replies[i].poststat.ia_size,
cb8e9e
-				priv->children[i]->name,
cb8e9e
-				uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "SIZE mismatch "
cb8e9e
+                                      "%lld vs %lld on %s for gfid:%s",
cb8e9e
+                                      (long long) first.ia_size,
cb8e9e
+                                      (long long) replies[i].poststat.ia_size,
cb8e9e
+                                      priv->children[i]->name,
cb8e9e
+                                      uuid_utoa (replies[i].poststat.ia_gfid));
cb8e9e
 
cb8e9e
                         if (data_selfheal)
cb8e9e
                                 *data_selfheal = _gf_true;
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
cb8e9e
index 4ab6f00..f4aae3f 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
cb8e9e
@@ -18,6 +18,7 @@
cb8e9e
 #include "afr-self-heal.h"
cb8e9e
 #include "byte-order.h"
cb8e9e
 #include "protocol-common.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 enum {
cb8e9e
 	AFR_SELFHEAL_DATA_FULL = 0,
cb8e9e
@@ -660,10 +661,12 @@ __afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd,
cb8e9e
 				    data_lock);
cb8e9e
 	{
cb8e9e
 		if (ret < AFR_SH_MIN_PARTICIPANTS) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "self-heal as only %d number of subvolumes "
cb8e9e
-                                "could be locked", uuid_utoa (fd->inode->gfid),
cb8e9e
-                                ret);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "self-heal as only %d number "
cb8e9e
+                                      "of subvolumes "
cb8e9e
+                                      "could be locked",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid),
cb8e9e
+                                      ret);
cb8e9e
 			ret = -ENOTCONN;
cb8e9e
 			goto unlock;
cb8e9e
 		}
cb8e9e
@@ -778,8 +781,8 @@ afr_selfheal_data (call_frame_t *frame, xlator_t *this, inode_t *inode)
cb8e9e
 
cb8e9e
 	fd = afr_selfheal_data_open (this, inode);
cb8e9e
 	if (!fd) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "%s: Failed to open",
cb8e9e
-                        uuid_utoa (inode->gfid));
cb8e9e
+                gf_msg_debug (this->name, 0, "%s: Failed to open",
cb8e9e
+                              uuid_utoa (inode->gfid));
cb8e9e
                 return -EIO;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -789,9 +792,10 @@ afr_selfheal_data (call_frame_t *frame, xlator_t *this, inode_t *inode)
cb8e9e
 				       locked_on);
cb8e9e
 	{
cb8e9e
 		if (ret < AFR_SH_MIN_PARTICIPANTS) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "self-heal as only %d number of subvolumes "
cb8e9e
-                                "could be locked", uuid_utoa (fd->inode->gfid),
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "self-heal as only %d number of "
cb8e9e
+                                      "subvolumes could be locked",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid),
cb8e9e
                                 ret);
cb8e9e
 			/* Either less than two subvols available, or another
cb8e9e
 			   selfheal (from another server) is in progress. Skip
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
cb8e9e
index 12da920..13a280f 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
cb8e9e
@@ -18,6 +18,7 @@
cb8e9e
 #include "afr-self-heal.h"
cb8e9e
 #include "byte-order.h"
cb8e9e
 #include "afr-transaction.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 /* Max file name length is 255 this filename is of length 256. No file with
cb8e9e
  * this name can ever come, entry-lock with this name is going to prevent
cb8e9e
@@ -51,7 +52,8 @@ afr_selfheal_entry_delete (xlator_t *this, inode_t *dir, const char *name,
cb8e9e
 	if (replies[child].valid && replies[child].op_ret == 0) {
cb8e9e
 		switch (replies[child].poststat.ia_type) {
cb8e9e
 		case IA_IFDIR:
cb8e9e
-			gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+		        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                AFR_MSG_EXPUNGING_FILE_OR_DIR,
cb8e9e
 				"expunging dir %s/%s (%s) on %s",
cb8e9e
 				uuid_utoa (dir->gfid), name,
cb8e9e
 				uuid_utoa_r (replies[child].poststat.ia_gfid, g),
cb8e9e
@@ -59,7 +61,8 @@ afr_selfheal_entry_delete (xlator_t *this, inode_t *dir, const char *name,
cb8e9e
 			ret = syncop_rmdir (subvol, &loc, 1, NULL, NULL);
cb8e9e
 			break;
cb8e9e
 		default:
cb8e9e
-			gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+		        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                AFR_MSG_EXPUNGING_FILE_OR_DIR,
cb8e9e
 				"expunging file %s/%s (%s) on %s",
cb8e9e
 				uuid_utoa (dir->gfid), name,
cb8e9e
 				uuid_utoa_r (replies[child].poststat.ia_gfid, g),
cb8e9e
@@ -239,7 +242,8 @@ afr_selfheal_detect_gfid_and_type_mismatch (xlator_t *this,
cb8e9e
 
cb8e9e
                 if (gf_uuid_compare (replies[src_idx].poststat.ia_gfid,
cb8e9e
                                   replies[i].poststat.ia_gfid)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Gfid mismatch "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_SPLIT_BRAIN, "Gfid mismatch "
cb8e9e
                                 "detected for <%s/%s>, %s on %s and %s on %s. "
cb8e9e
                                 "Skipping conservative merge on the file.",
cb8e9e
                                 uuid_utoa (pargfid), bname,
cb8e9e
@@ -252,7 +256,8 @@ afr_selfheal_detect_gfid_and_type_mismatch (xlator_t *this,
cb8e9e
 
cb8e9e
                 if ((replies[src_idx].poststat.ia_type) !=
cb8e9e
                     (replies[i].poststat.ia_type)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Type mismatch "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_SPLIT_BRAIN, "Type mismatch "
cb8e9e
                                 "detected for <%s/%s>, %d on %s and %d on %s. "
cb8e9e
                                 "Skipping conservative merge on the file.",
cb8e9e
                                 uuid_utoa (pargfid), bname,
cb8e9e
@@ -462,10 +467,11 @@ afr_selfheal_entry_dirent (call_frame_t *frame, xlator_t *this,
cb8e9e
                                     locked_on);
cb8e9e
 	{
cb8e9e
 		if (ret < AFR_SH_MIN_PARTICIPANTS) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "entry self-heal as only %d sub-volumes could "
cb8e9e
-                                "be locked in %s domain",
cb8e9e
-                                uuid_utoa (fd->inode->gfid), ret, this->name);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "entry self-heal as only %d sub-volumes "
cb8e9e
+                                      " could be locked in %s domain",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid),
cb8e9e
+                                      ret, this->name);
cb8e9e
 			ret = -ENOTCONN;
cb8e9e
 			goto unlock;
cb8e9e
 		}
cb8e9e
@@ -578,7 +584,8 @@ afr_selfheal_entry_do (call_frame_t *frame, xlator_t *this, fd_t *fd,
cb8e9e
 
cb8e9e
 	priv = this->private;
cb8e9e
 
cb8e9e
-	gf_log (this->name, GF_LOG_INFO, "performing entry selfheal on %s",
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                AFR_MSG_SELF_HEAL_INFO, "performing entry selfheal on %s",
cb8e9e
 		uuid_utoa (fd->inode->gfid));
cb8e9e
 
cb8e9e
 	for (i = 0; i < priv->child_count; i++) {
cb8e9e
@@ -628,11 +635,11 @@ __afr_selfheal_entry (call_frame_t *frame, xlator_t *this, fd_t *fd,
cb8e9e
 				    data_lock);
cb8e9e
 	{
cb8e9e
 		if (ret < AFR_SH_MIN_PARTICIPANTS) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "entry self-heal as only %d sub-volumes could "
cb8e9e
-                                "be locked in %s domain",
cb8e9e
-                                uuid_utoa (fd->inode->gfid), ret,
cb8e9e
-                                this->name);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "entry self-heal as only %d sub-volumes could "
cb8e9e
+                                      "be locked in %s domain",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid), ret,
cb8e9e
+                                      this->name);
cb8e9e
 			ret = -ENOTCONN;
cb8e9e
 			goto unlock;
cb8e9e
 		}
cb8e9e
@@ -671,12 +678,13 @@ unlock:
cb8e9e
                                     postop_lock);
cb8e9e
         {
cb8e9e
                 if (AFR_CMP (data_lock, postop_lock, priv->child_count) != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "post-op after entry self-heal as %d "
cb8e9e
-                                "sub-volumes, as opposed to %d, could be locked"
cb8e9e
-                                " in %s domain", uuid_utoa (fd->inode->gfid),
cb8e9e
-                                ret, AFR_COUNT (data_lock, priv->child_count),
cb8e9e
-                                this->name);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "post-op after entry self-heal as %d "
cb8e9e
+                                      "sub-volumes, as opposed to %d, "
cb8e9e
+                                      "could be locked in %s domain",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid),
cb8e9e
+                                      ret, AFR_COUNT (data_lock,
cb8e9e
+                                      priv->child_count), this->name);
cb8e9e
                         ret = -ENOTCONN;
cb8e9e
                         goto postop_unlock;
cb8e9e
                 }
cb8e9e
@@ -751,11 +759,11 @@ afr_selfheal_entry (call_frame_t *frame, xlator_t *this, inode_t *inode)
cb8e9e
 				       locked_on);
cb8e9e
 	{
cb8e9e
 		if (ret < AFR_SH_MIN_PARTICIPANTS) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping "
cb8e9e
-                                "entry self-heal as only %d sub-volumes could "
cb8e9e
-                                "be locked in %s domain",
cb8e9e
-                                uuid_utoa (fd->inode->gfid), ret,
cb8e9e
-                                priv->sh_domain);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: Skipping "
cb8e9e
+                                      "entry self-heal as only %d sub-volumes could "
cb8e9e
+                                      "be locked in %s domain",
cb8e9e
+                                      uuid_utoa (fd->inode->gfid), ret,
cb8e9e
+                                      priv->sh_domain);
cb8e9e
 			/* Either less than two subvols available, or another
cb8e9e
 			   selfheal (from another server) is in progress. Skip
cb8e9e
 			   for now in any case there isn't anything to do.
cb8e9e
@@ -768,12 +776,13 @@ afr_selfheal_entry (call_frame_t *frame, xlator_t *this, inode_t *inode)
cb8e9e
                                                LONG_FILENAME, long_name_locked);
cb8e9e
                 {
cb8e9e
                         if (ret < 1) {
cb8e9e
-                                gf_log (this->name, GF_LOG_DEBUG, "%s: Skipping"
cb8e9e
-                                        " entry self-heal as only %d "
cb8e9e
-                                        "sub-volumes could be locked in "
cb8e9e
-                                        "special-filename domain",
cb8e9e
-                                        uuid_utoa (fd->inode->gfid),
cb8e9e
-                                        ret);
cb8e9e
+                                gf_msg_debug (this->name, 0, "%s: Skipping"
cb8e9e
+                                              " entry self-heal as only %d "
cb8e9e
+                                              "sub-volumes could be "
cb8e9e
+                                              "locked in special-filename "
cb8e9e
+                                              "domain",
cb8e9e
+                                              uuid_utoa (fd->inode->gfid),
cb8e9e
+                                              ret);
cb8e9e
                                 ret = -ENOTCONN;
cb8e9e
                                 goto unlock;
cb8e9e
                         }
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
cb8e9e
index 11c0c9c..c4993f1 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
cb8e9e
@@ -51,7 +51,8 @@ __afr_selfheal_metadata_do (call_frame_t *frame, xlator_t *this, inode_t *inode,
cb8e9e
 	loc.inode = inode_ref (inode);
cb8e9e
 	gf_uuid_copy (loc.gfid, inode->gfid);
cb8e9e
 
cb8e9e
-	gf_log (this->name, GF_LOG_INFO, "performing metadata selfheal on %s",
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                AFR_MSG_SELF_HEAL_INFO, "performing metadata selfheal on %s",
cb8e9e
 		uuid_utoa (inode->gfid));
cb8e9e
 
cb8e9e
 	ret = syncop_getxattr (priv->children[source], &loc, &xattr, NULL,
cb8e9e
@@ -232,7 +233,8 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this,
cb8e9e
 		source = afr_dirtime_splitbrain_source (frame, this,
cb8e9e
 							replies, locked_on);
cb8e9e
 		if (source != -1) {
cb8e9e
-			gf_log (this->name, GF_LOG_NOTICE, "clear time "
cb8e9e
+		        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                AFR_MSG_SPLIT_BRAIN, "clear time "
cb8e9e
 				"split brain on %s",
cb8e9e
 				 uuid_utoa (replies[source].poststat.ia_gfid));
cb8e9e
 			sources[source] = 1;
cb8e9e
@@ -277,10 +279,11 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this,
cb8e9e
 		    !IA_EQUAL (first, replies[i].poststat, uid) ||
cb8e9e
 		    !IA_EQUAL (first, replies[i].poststat, gid) ||
cb8e9e
 		    !IA_EQUAL (first, replies[i].poststat, prot)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: iatt mismatch "
cb8e9e
-                                "for source(%d) vs (%d)",
cb8e9e
-                                uuid_utoa (replies[source].poststat.ia_gfid),
cb8e9e
-                                source, i);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: iatt mismatch "
cb8e9e
+                                      "for source(%d) vs (%d)",
cb8e9e
+                                      uuid_utoa
cb8e9e
+                                      (replies[source].poststat.ia_gfid),
cb8e9e
+                                      source, i);
cb8e9e
 			sources[i] = 0;
cb8e9e
 			healed_sinks[i] = 1;
cb8e9e
 		}
cb8e9e
@@ -291,10 +294,11 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this,
cb8e9e
 			continue;
cb8e9e
                 if (!afr_xattrs_are_equal (replies[source].xdata,
cb8e9e
                                            replies[i].xdata)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "%s: xattr mismatch "
cb8e9e
-                                "for source(%d) vs (%d)",
cb8e9e
-                                uuid_utoa (replies[source].poststat.ia_gfid),
cb8e9e
-                                source, i);
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s: xattr mismatch "
cb8e9e
+                                      "for source(%d) vs (%d)",
cb8e9e
+                                      uuid_utoa
cb8e9e
+                                      (replies[source].poststat.ia_gfid),
cb8e9e
+                                      source, i);
cb8e9e
                         sources[i] = 0;
cb8e9e
                         healed_sinks[i] = 1;
cb8e9e
                 }
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
cb8e9e
index ba9c3ee..190be64 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
cb8e9e
@@ -16,6 +16,7 @@
cb8e9e
 
cb8e9e
 #include "afr.h"
cb8e9e
 #include "afr-self-heal.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 int
cb8e9e
 __afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid,
cb8e9e
@@ -172,20 +173,24 @@ __afr_selfheal_name_expunge (xlator_t *this, inode_t *parent, uuid_t pargfid,
cb8e9e
 
cb8e9e
 		switch (replies[i].poststat.ia_type) {
cb8e9e
 		case IA_IFDIR:
cb8e9e
-			gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-				"expunging dir %s/%s (%s) on %s",
cb8e9e
-				uuid_utoa (pargfid), bname,
cb8e9e
-				uuid_utoa_r (replies[i].poststat.ia_gfid, g),
cb8e9e
-				priv->children[i]->name);
cb8e9e
+		        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                AFR_MSG_EXPUNGING_FILE_OR_DIR,
cb8e9e
+			        "expunging dir %s/%s (%s) on %s",
cb8e9e
+			        uuid_utoa (pargfid), bname,
cb8e9e
+			        uuid_utoa_r (replies[i].poststat.ia_gfid, g),
cb8e9e
+			        priv->children[i]->name);
cb8e9e
+
cb8e9e
 			ret |= syncop_rmdir (priv->children[i], &loc, 1, NULL,
cb8e9e
                                              NULL);
cb8e9e
 			break;
cb8e9e
 		default:
cb8e9e
-			gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-				"expunging file %s/%s (%s) on %s",
cb8e9e
-				uuid_utoa (pargfid), bname,
cb8e9e
-				uuid_utoa_r (replies[i].poststat.ia_gfid, g),
cb8e9e
-				priv->children[i]->name);
cb8e9e
+		        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                AFR_MSG_EXPUNGING_FILE_OR_DIR,
cb8e9e
+		                "expunging file %s/%s (%s) on %s",
cb8e9e
+			        uuid_utoa (pargfid), bname,
cb8e9e
+			        uuid_utoa_r (replies[i].poststat.ia_gfid, g),
cb8e9e
+			        priv->children[i]->name);
cb8e9e
+
cb8e9e
 			ret |= syncop_unlink (priv->children[i], &loc, NULL,
cb8e9e
                                               NULL);
cb8e9e
 			break;
cb8e9e
@@ -294,15 +299,16 @@ afr_selfheal_name_type_mismatch_check (xlator_t *this, struct afr_reply *replies
cb8e9e
                 if (sources[i] || source == -1) {
cb8e9e
                         if ((sources[type_idx] || source == -1) &&
cb8e9e
                             (inode_type != replies[i].poststat.ia_type)) {
cb8e9e
-                                    gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
-                                            AFR_MSG_SPLIT_BRAIN,
cb8e9e
-                                            "Type mismatch for <gfid:%s>/%s: "
cb8e9e
-                                            "%d on %s and %d on %s",
cb8e9e
-                                            uuid_utoa(pargfid), bname,
cb8e9e
-                                            replies[i].poststat.ia_type,
cb8e9e
-                                            priv->children[i]->name,
cb8e9e
-                                            replies[type_idx].poststat.ia_type,
cb8e9e
-                                            priv->children[type_idx]->name);
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        AFR_MSG_SPLIT_BRAIN,
cb8e9e
+                                        "Type mismatch for <gfid:%s>/%s: "
cb8e9e
+                                        "%d on %s and %d on %s",
cb8e9e
+                                        uuid_utoa(pargfid), bname,
cb8e9e
+                                        replies[i].poststat.ia_type,
cb8e9e
+                                        priv->children[i]->name,
cb8e9e
+                                        replies[type_idx].poststat.ia_type,
cb8e9e
+                                        priv->children[type_idx]->name);
cb8e9e
+
cb8e9e
                                     return -EIO;
cb8e9e
                         }
cb8e9e
                         inode_type = replies[i].poststat.ia_type;
cb8e9e
@@ -342,7 +348,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies
cb8e9e
 		if (sources[i] || source == -1) {
cb8e9e
 			if ((sources[gfid_idx_iter] || source == -1) &&
cb8e9e
 			    gf_uuid_compare (gfid, replies[i].poststat.ia_gfid)) {
cb8e9e
-				gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+			        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
                                         AFR_MSG_SPLIT_BRAIN,
cb8e9e
 					"GFID mismatch for <gfid:%s>/%s "
cb8e9e
 					"%s on %s and %s on %s",
cb8e9e
@@ -351,6 +357,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies
cb8e9e
 					priv->children[i]->name,
cb8e9e
 					uuid_utoa_r (replies[gfid_idx_iter].poststat.ia_gfid, g2),
cb8e9e
 					priv->children[gfid_idx_iter]->name);
cb8e9e
+
cb8e9e
 				return -EIO;
cb8e9e
 			}
cb8e9e
 
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
cb8e9e
index fe93675..7bc39a1 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-self-heald.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-self-heald.c
cb8e9e
@@ -19,6 +19,7 @@
cb8e9e
 #include "afr-self-heald.h"
cb8e9e
 #include "protocol-common.h"
cb8e9e
 #include "syncop-utils.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 #define SHD_INODE_LRU_LIMIT          2048
cb8e9e
 #define AFR_EH_SPLIT_BRAIN_LIMIT     1024
cb8e9e
@@ -209,8 +210,8 @@ afr_shd_index_inode (xlator_t *this, xlator_t *subvol)
cb8e9e
 	if (ret)
cb8e9e
 		goto out;
cb8e9e
 
cb8e9e
-	gf_log (this->name, GF_LOG_DEBUG, "index-dir gfid for %s: %s",
cb8e9e
-		subvol->name, uuid_utoa (index_gfid));
cb8e9e
+        gf_msg_debug (this->name, 0, "index-dir gfid for %s: %s",
cb8e9e
+	              subvol->name, uuid_utoa (index_gfid));
cb8e9e
 
cb8e9e
 	inode = afr_shd_inode_find (this, subvol, index_gfid);
cb8e9e
 
cb8e9e
@@ -405,8 +406,8 @@ afr_shd_index_heal (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
cb8e9e
         if (!priv->shd.enabled)
cb8e9e
                 return -EBUSY;
cb8e9e
 
cb8e9e
-        gf_log (healer->this->name, GF_LOG_DEBUG, "got entry: %s",
cb8e9e
-                entry->d_name);
cb8e9e
+        gf_msg_debug (healer->this->name, 0, "got entry: %s",
cb8e9e
+                      entry->d_name);
cb8e9e
 
cb8e9e
         ret = gf_uuid_parse (entry->d_name, gfid);
cb8e9e
         if (ret)
cb8e9e
@@ -440,8 +441,9 @@ afr_shd_index_sweep (struct subvol_healer *healer)
cb8e9e
 
cb8e9e
 	loc.inode = afr_shd_index_inode (healer->this, subvol);
cb8e9e
 	if (!loc.inode) {
cb8e9e
-		gf_log (healer->this->name, GF_LOG_WARNING,
cb8e9e
-			"unable to get index-dir on %s", subvol->name);
cb8e9e
+	        gf_msg (healer->this->name, GF_LOG_WARNING,
cb8e9e
+                        0, AFR_MSG_INDEX_DIR_GET_FAILED,
cb8e9e
+		        "unable to get index-dir on %s", subvol->name);
cb8e9e
 		return -errno;
cb8e9e
 	}
cb8e9e
 
cb8e9e
@@ -507,9 +509,9 @@ afr_shd_index_healer (void *data)
cb8e9e
 		ASSERT_LOCAL(this, healer);
cb8e9e
 
cb8e9e
 		do {
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"starting index sweep on subvol %s",
cb8e9e
-				afr_subvol_name (this, healer->subvol));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+		                      "starting index sweep on subvol %s",
cb8e9e
+			              afr_subvol_name (this, healer->subvol));
cb8e9e
 
cb8e9e
 			afr_shd_sweep_prepare (healer);
cb8e9e
 
cb8e9e
@@ -524,9 +526,9 @@ afr_shd_index_healer (void *data)
cb8e9e
 			  could not be healed thus far.
cb8e9e
 			*/
cb8e9e
 
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"finished index sweep on subvol %s",
cb8e9e
-				afr_subvol_name (this, healer->subvol));
cb8e9e
+		        gf_msg_debug (this->name, 0,
cb8e9e
+			              "finished index sweep on subvol %s",
cb8e9e
+			              afr_subvol_name (this, healer->subvol));
cb8e9e
 			/*
cb8e9e
 			  Give a pause before retrying to avoid a busy loop
cb8e9e
 			  in case the only entry in index is because of
cb8e9e
@@ -564,9 +566,9 @@ afr_shd_full_healer (void *data)
cb8e9e
 
cb8e9e
 		ASSERT_LOCAL(this, healer);
cb8e9e
 
cb8e9e
-		gf_log (this->name, GF_LOG_INFO,
cb8e9e
-			"starting full sweep on subvol %s",
cb8e9e
-			afr_subvol_name (this, healer->subvol));
cb8e9e
+	        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_SELF_HEAL_INFO,
cb8e9e
+		        "starting full sweep on subvol %s",
cb8e9e
+		        afr_subvol_name (this, healer->subvol));
cb8e9e
 
cb8e9e
 		afr_shd_sweep_prepare (healer);
cb8e9e
 
cb8e9e
@@ -574,9 +576,9 @@ afr_shd_full_healer (void *data)
cb8e9e
 
cb8e9e
 		afr_shd_sweep_done (healer);
cb8e9e
 
cb8e9e
-		gf_log (this->name, GF_LOG_INFO,
cb8e9e
-			"finished full sweep on subvol %s",
cb8e9e
-			afr_subvol_name (this, healer->subvol));
cb8e9e
+	        gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_SELF_HEAL_INFO,
cb8e9e
+		        "finished full sweep on subvol %s",
cb8e9e
+		        afr_subvol_name (this, healer->subvol));
cb8e9e
 	}
cb8e9e
 
cb8e9e
 	return NULL;
cb8e9e
@@ -681,7 +683,8 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (output, this->name, &xl_id);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "xl does not have id");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        AFR_MSG_DICT_GET_FAILED, "xl does not have id");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -693,8 +696,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                   xl_id, child, count);
cb8e9e
         ret = dict_set_uint64(output, key, healed_count);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_healed_count to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not add statistics_healed_count to outout");
cb8e9e
                 goto out;
cb8e9e
 	}
cb8e9e
 
cb8e9e
@@ -702,8 +706,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                   xl_id, child, count);
cb8e9e
         ret = dict_set_uint64 (output, key, split_brain_count);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_split_brain_count to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not add statistics_split_brain_count to outout");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -711,8 +716,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                   xl_id, child, count);
cb8e9e
         ret = dict_set_str (output, key, crawl_type);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_crawl_type to output");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+	                "Could not add statistics_crawl_type to output");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -720,8 +726,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                   xl_id, child, count);
cb8e9e
         ret = dict_set_uint64 (output, key, heal_failed_count);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_healed_failed_count to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+	                "Could not add statistics_healed_failed_count to outout");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -729,8 +736,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                   xl_id, child, count);
cb8e9e
         ret = dict_set_dynstr (output, key, start_time_str);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_crawl_start_time to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not add statistics_crawl_start_time to outout");
cb8e9e
                 goto out;
cb8e9e
         } else {
cb8e9e
 		start_time_str = NULL;
cb8e9e
@@ -747,8 +755,9 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
                 end_time_str = gf_strdup ("Could not determine the end time");
cb8e9e
         ret = dict_set_dynstr (output, key, end_time_str);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_crawl_end_time to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not add statistics_crawl_end_time to outout");
cb8e9e
                 goto out;
cb8e9e
         } else {
cb8e9e
 		end_time_str = NULL;
cb8e9e
@@ -759,16 +768,18 @@ afr_shd_dict_add_crawl_event (xlator_t *this, dict_t *output,
cb8e9e
 
cb8e9e
         ret = dict_set_int32 (output, key, progress);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not add statistics_inprogress to outout");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not add statistics_inprogress to outout");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
 	snprintf (key, sizeof (key), "statistics-%d-%d-count", xl_id, child);
cb8e9e
 	ret = dict_set_uint64 (output, key, count + 1);
cb8e9e
 	if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Could not increment the counter.");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+		        "Could not increment the counter.");
cb8e9e
                 goto out;
cb8e9e
 	}
cb8e9e
 out:
cb8e9e
@@ -789,7 +800,8 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (output, this->name, &xl_id);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "xl does not have id");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        AFR_MSG_DICT_GET_FAILED, "xl does not have id");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -800,7 +812,8 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
cb8e9e
 	ret = dict_set_dynstr (output, key, path);
cb8e9e
 
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "%s: Could not add to output",
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        AFR_MSG_DICT_SET_FAILED, "%s: Could not add to output",
cb8e9e
                         path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -810,8 +823,10 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
cb8e9e
 			  child, count);
cb8e9e
 		ret = dict_set_uint32 (output, key, tv->tv_sec);
cb8e9e
 		if (ret) {
cb8e9e
-			gf_log (this->name, GF_LOG_ERROR, "%s: Could not set time",
cb8e9e
-				path);
cb8e9e
+		        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                                "%s: Could not set time",
cb8e9e
+			        path);
cb8e9e
 			goto out;
cb8e9e
 		}
cb8e9e
 	}
cb8e9e
@@ -820,7 +835,9 @@ afr_shd_dict_add_path (xlator_t *this, dict_t *output, int child, char *path,
cb8e9e
 
cb8e9e
         ret = dict_set_uint64 (output, key, count + 1);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Could not increment count");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        -ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
+                        "Could not increment count");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -844,8 +861,8 @@ afr_shd_gather_entry (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
cb8e9e
         this = THIS;
cb8e9e
         priv = this->private;
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "got entry: %s",
cb8e9e
-                entry->d_name);
cb8e9e
+        gf_msg_debug (this->name, 0, "got entry: %s",
cb8e9e
+                      entry->d_name);
cb8e9e
 
cb8e9e
         ret = gf_uuid_parse (entry->d_name, gfid);
cb8e9e
         if (ret)
cb8e9e
@@ -882,7 +899,8 @@ afr_shd_gather_index_entries (xlator_t *this, int child, dict_t *output)
cb8e9e
 
cb8e9e
         loc.inode = afr_shd_index_inode (this, subvol);
cb8e9e
         if (!loc.inode) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        0, AFR_MSG_INDEX_DIR_GET_FAILED,
cb8e9e
                         "unable to get index-dir on %s", subvol->name);
cb8e9e
                 return -errno;
cb8e9e
         }
cb8e9e
@@ -1187,7 +1205,8 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)
cb8e9e
                 break;
cb8e9e
 
cb8e9e
         default:
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Unknown set op %d", op);
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INVALID_ARG, "Unknown set op %d", op);
cb8e9e
                 break;
cb8e9e
         }
cb8e9e
 out:
cb8e9e
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
cb8e9e
index b27cfed..ba50abd 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr-transaction.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr-transaction.c
cb8e9e
@@ -16,6 +16,8 @@
cb8e9e
 #include "afr.h"
cb8e9e
 #include "afr-transaction.h"
cb8e9e
 #include "afr-self-heal.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
+
cb8e9e
 #include <signal.h>
cb8e9e
 
cb8e9e
 gf_boolean_t
cb8e9e
@@ -1220,13 +1222,14 @@ afr_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
cb8e9e
         int_lock = &local->internal_lock;
cb8e9e
 
cb8e9e
         if (int_lock->lock_op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        0, AFR_MSG_BLOCKING_LKS_FAILED,
cb8e9e
                         "Blocking inodelks failed.");
cb8e9e
                 local->transaction.done (frame, this);
cb8e9e
         } else {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Blocking inodelks done. Proceeding to FOP");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Blocking inodelks done. Proceeding to FOP");
cb8e9e
                 afr_internal_lock_finish (frame, this);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1245,14 +1248,14 @@ afr_post_nonblocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
         /* Initiate blocking locks if non-blocking has failed */
cb8e9e
         if (int_lock->lock_op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Non blocking inodelks failed. Proceeding to blocking");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Non blocking inodelks failed. Proceeding to blocking");
cb8e9e
                 int_lock->lock_cbk = afr_post_blocking_inodelk_cbk;
cb8e9e
                 afr_blocking_lock (frame, this);
cb8e9e
         } else {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Non blocking inodelks done. Proceeding to FOP");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Non blocking inodelks done. Proceeding to FOP");
cb8e9e
                 afr_internal_lock_finish (frame, this);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1270,13 +1273,14 @@ afr_post_blocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
cb8e9e
         int_lock = &local->internal_lock;
cb8e9e
 
cb8e9e
         if (int_lock->lock_op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        AFR_MSG_BLOCKING_LKS_FAILED,
cb8e9e
                         "Blocking entrylks failed.");
cb8e9e
                 local->transaction.done (frame, this);
cb8e9e
         } else {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Blocking entrylks done. Proceeding to FOP");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                             "Blocking entrylks done. Proceeding to FOP");
cb8e9e
                 afr_internal_lock_finish (frame, this);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1295,14 +1299,15 @@ afr_post_nonblocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
         /* Initiate blocking locks if non-blocking has failed */
cb8e9e
         if (int_lock->lock_op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Non blocking entrylks failed. Proceeding to blocking");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Non blocking entrylks failed. Proceeding to blocking");
cb8e9e
                 int_lock->lock_cbk = afr_post_blocking_entrylk_cbk;
cb8e9e
                 afr_blocking_lock (frame, this);
cb8e9e
         } else {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Non blocking entrylks done. Proceeding to FOP");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Non blocking entrylks done. Proceeding to FOP");
cb8e9e
+
cb8e9e
                 afr_internal_lock_finish (frame, this);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1320,13 +1325,16 @@ afr_post_blocking_rename_cbk (call_frame_t *frame, xlator_t *this)
cb8e9e
         int_lock = &local->internal_lock;
cb8e9e
 
cb8e9e
         if (int_lock->lock_op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        AFR_MSG_BLOCKING_LKS_FAILED,
cb8e9e
                         "Blocking entrylks failed.");
cb8e9e
+
cb8e9e
                 local->transaction.done (frame, this);
cb8e9e
         } else {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Blocking entrylks done. Proceeding to FOP");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Blocking entrylks done. Proceeding to FOP");
cb8e9e
+
cb8e9e
                 afr_internal_lock_finish (frame, this);
cb8e9e
         }
cb8e9e
         return 0;
cb8e9e
@@ -1477,7 +1485,8 @@ afr_are_multiple_fds_opened (fd_t *fd, xlator_t *this)
cb8e9e
                 /* If false is returned, it may keep on taking eager-lock
cb8e9e
                  * which may lead to starvation, so return true to avoid that.
cb8e9e
                  */
cb8e9e
-                gf_log_callingfn (this->name, GF_LOG_ERROR, "Invalid fd");
cb8e9e
+                gf_msg_callingfn (this->name, GF_LOG_ERROR, EBADF,
cb8e9e
+                                  AFR_MSG_INVALID_ARG, "Invalid fd");
cb8e9e
                 return _gf_true;
cb8e9e
         }
cb8e9e
         /* Lets say mount1 has eager-lock(full-lock) and after the eager-lock
cb8e9e
@@ -1597,7 +1606,8 @@ afr_changelog_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 /* Failure of fsync() is as good as failure of previous
cb8e9e
                    write(). So treat it like one.
cb8e9e
 		*/
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        op_errno, AFR_MSG_FSYNC_FAILED,
cb8e9e
                         "fsync(%s) failed on subvolume %s. Transaction was %s",
cb8e9e
                         uuid_utoa (local->fd->inode->gfid),
cb8e9e
                         priv->children[child_index]->name,
cb8e9e
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
cb8e9e
index 26efe93..5ef920a 100644
cb8e9e
--- a/xlators/cluster/afr/src/afr.c
cb8e9e
+++ b/xlators/cluster/afr/src/afr.c
cb8e9e
@@ -20,6 +20,7 @@
cb8e9e
 #include "config.h"
cb8e9e
 #endif
cb8e9e
 #include "afr-common.c"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 struct volume_options options[];
cb8e9e
 
cb8e9e
@@ -50,8 +51,6 @@ mem_acct_init (xlator_t *this)
cb8e9e
         ret = xlator_mem_acct_init (this, gf_afr_mt_end + 1);
cb8e9e
 
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
cb8e9e
-                       "failed");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -162,7 +161,8 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         if (read_subvol) {
cb8e9e
                 index = xlator_subvolume_index (this, read_subvol);
cb8e9e
                 if (index == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "%s not a subvolume",
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_INVALID_SUBVOL, "%s not a subvolume",
cb8e9e
                                 read_subvol->name);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -174,8 +174,9 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         if (read_subvol_index >-1) {
cb8e9e
                 index=read_subvol_index;
cb8e9e
                 if (index >= priv->child_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "%d not a subvolume-index",
cb8e9e
-                                index);
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_INVALID_SUBVOL,
cb8e9e
+                                "%d not a subvolume-index", index);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 priv->read_child = index;
cb8e9e
@@ -249,15 +250,16 @@ init (xlator_t *this)
cb8e9e
         char          *qtype       = NULL;
cb8e9e
 
cb8e9e
         if (!this->children) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_CHILD_MISCONFIGURED,
cb8e9e
                         "replicate translator needs more than one "
cb8e9e
                         "subvolume defined.");
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (!this->parents) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                        "Volume is dangling.");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        AFR_MSG_VOL_MISCONFIGURED, "Volume is dangling.");
cb8e9e
         }
cb8e9e
 
cb8e9e
 	this->private = GF_CALLOC (1, sizeof (afr_private_t),
cb8e9e
@@ -287,7 +289,8 @@ init (xlator_t *this)
cb8e9e
         if (read_subvol) {
cb8e9e
                 priv->read_child = xlator_subvolume_index (this, read_subvol);
cb8e9e
                 if (priv->read_child == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "%s not a subvolume",
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_INVALID_SUBVOL, "%s not a subvolume",
cb8e9e
                                 read_subvol->name);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -295,8 +298,9 @@ init (xlator_t *this)
cb8e9e
         GF_OPTION_INIT ("read-subvolume-index",read_subvol_index,int32,out);
cb8e9e
         if (read_subvol_index > -1) {
cb8e9e
                 if (read_subvol_index >= priv->child_count) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "%d not a subvolume-index",
cb8e9e
-                                read_subvol_index);
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_INVALID_SUBVOL,
cb8e9e
+                                "%d not a subvolume-index", read_subvol_index);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 priv->read_child = read_subvol_index;
cb8e9e
@@ -310,11 +314,13 @@ init (xlator_t *this)
cb8e9e
         if (fav_child) {
cb8e9e
                 priv->favorite_child = xlator_subvolume_index (this, fav_child);
cb8e9e
                 if (priv->favorite_child == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "%s not a subvolume",
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                AFR_MSG_INVALID_SUBVOL, "%s not a subvolume, "
cb8e9e
+                                "cannot set it as favorite child",
cb8e9e
                                 fav_child->name);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0, AFR_MSG_FAVORITE_CHILD,
cb8e9e
                         favorite_child_warning_str, fav_child->name,
cb8e9e
                         fav_child->name, fav_child->name);
cb8e9e
         }
cb8e9e
@@ -444,8 +450,6 @@ init (xlator_t *this)
cb8e9e
         this->local_pool = mem_pool_new (afr_local_t, 512);
cb8e9e
         if (!this->local_pool) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "failed to create local_t's memory pool");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
cb8e9e
index ff8f586..2b4a150 100644
cb8e9e
--- a/xlators/cluster/afr/src/pump.c
cb8e9e
+++ b/xlators/cluster/afr/src/pump.c
cb8e9e
@@ -22,6 +22,7 @@
cb8e9e
 #include "defaults.c"
cb8e9e
 #include "glusterfs.h"
cb8e9e
 #include "pump.h"
cb8e9e
+#include "afr-messages.h"
cb8e9e
 
cb8e9e
 
cb8e9e
 static int
cb8e9e
@@ -42,7 +43,8 @@ afr_set_dict_gfid (dict_t *dict, uuid_t gfid)
cb8e9e
 
cb8e9e
         ret = dict_set_dynptr (dict, "gfid-req", pgfid, sizeof (uuid_t));
cb8e9e
         if (ret)
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "gfid set failed");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        AFR_MSG_DICT_SET_FAILED, "gfid set failed");
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret && pgfid)
cb8e9e
@@ -88,8 +90,6 @@ afr_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name)
cb8e9e
                                    name);
cb8e9e
 
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "asprintf failed while setting child path");
cb8e9e
         }
cb8e9e
 
cb8e9e
         child->name = strrchr (child->path, '/');
cb8e9e
@@ -231,10 +231,9 @@ pump_change_state (xlator_t *this, pump_state_t state)
cb8e9e
         }
cb8e9e
         UNLOCK (&pump_priv->pump_state_lock);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Pump changing state from %d to %d",
cb8e9e
-                state_old,
cb8e9e
-                state_new);
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Pump changing state from %d to %d",
cb8e9e
+                      state_old, state_new);
cb8e9e
 
cb8e9e
         return  0;
cb8e9e
 }
cb8e9e
@@ -284,18 +283,19 @@ pump_save_path (xlator_t *this, const char *path)
cb8e9e
         dict = dict_new ();
cb8e9e
         dict_ret = dict_set_str (dict, PUMP_PATH, (char *)path);
cb8e9e
         if (dict_ret)
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING,
cb8e9e
+                        -dict_ret, AFR_MSG_DICT_SET_FAILED,
cb8e9e
                         "%s: failed to set the key %s", path, PUMP_PATH);
cb8e9e
 
cb8e9e
         ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0, NULL,
cb8e9e
                                NULL);
cb8e9e
 
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, -ret, AFR_MSG_INFO_COMMON,
cb8e9e
                         "setxattr failed - could not save path=%s", path);
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "setxattr succeeded - saved path=%s", path);
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "setxattr succeeded - saved path=%s", path);
cb8e9e
         }
cb8e9e
 
cb8e9e
         dict_unref (dict);
cb8e9e
@@ -333,8 +333,8 @@ pump_check_and_update_status (xlator_t *this)
cb8e9e
         }
cb8e9e
         default:
cb8e9e
         {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Unknown pump state");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Unknown pump state");
cb8e9e
                 ret = -1;
cb8e9e
                 break;
cb8e9e
         }
cb8e9e
@@ -371,19 +371,21 @@ pump_update_resume_state (xlator_t *this, const char *path)
cb8e9e
         if (state == PUMP_STATE_RESUME) {
cb8e9e
                 resume_path = pump_get_resume_path (this);
cb8e9e
                 if (strcmp (resume_path, "/") == 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "Reached the resume path (/). Proceeding to change state"
cb8e9e
-                                " to running");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "Reached the resume path (/). Proceeding to change state"
cb8e9e
+                                      " to running");
cb8e9e
+
cb8e9e
                         pump_change_state (this, PUMP_STATE_RUNNING);
cb8e9e
                 } else if (strcmp (resume_path, path) == 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "Reached the resume path. Proceeding to change state"
cb8e9e
-                                " to running");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "Reached the resume path. Proceeding to change state"
cb8e9e
+                                      " to running");
cb8e9e
+
cb8e9e
                         pump_change_state (this, PUMP_STATE_RUNNING);
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "Not yet hit the resume path:res-path=%s,path=%s",
cb8e9e
-                                resume_path, path);
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "Not yet hit the resume path:res-path=%s,path=%s",
cb8e9e
+                                      resume_path, path);
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -402,12 +404,12 @@ is_pump_traversal_allowed (xlator_t *this, const char *path)
cb8e9e
         if (state == PUMP_STATE_RESUME) {
cb8e9e
                 resume_path = pump_get_resume_path (this);
cb8e9e
                 if (strstr (resume_path, path)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "On the right path to resumption path");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "On the right path to resumption path");
cb8e9e
                         ret = _gf_true;
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "Not the right path to resuming=> ignoring traverse");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "Not the right path to resuming=> ignoring traverse");
cb8e9e
                         ret = _gf_false;
cb8e9e
                 }
cb8e9e
         }
cb8e9e
@@ -460,39 +462,40 @@ gf_pump_traverse_directory (loc_t *loc)
cb8e9e
 
cb8e9e
 	fd = fd_create (loc->inode, pump_pid);
cb8e9e
         if (!fd) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, AFR_MSG_FD_CREATE_FAILED,
cb8e9e
                         "Failed to create fd for %s", loc->path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = syncop_opendir (this, loc, fd, NULL, NULL);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "opendir failed on %s", loc->path);
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "opendir failed on %s", loc->path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                "pump opendir on %s returned=%d",
cb8e9e
-                loc->path, ret);
cb8e9e
+        gf_msg_trace (this->name, 0,
cb8e9e
+                      "pump opendir on %s returned=%d",
cb8e9e
+                      loc->path, ret);
cb8e9e
 
cb8e9e
         while (syncop_readdirp (this, fd, 131072, offset, &entries, NULL,
cb8e9e
                                 NULL)) {
cb8e9e
                 free_entries = _gf_true;
cb8e9e
 
cb8e9e
                 if (list_empty (&entries.list)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                "no more entries in directory");
cb8e9e
+                        gf_msg_trace (this->name, 0,
cb8e9e
+                                      "no more entries in directory");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
 
cb8e9e
                 list_for_each_entry_safe (entry, tmp, &entries.list, list) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "found readdir entry=%s", entry->d_name);
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "found readdir entry=%s", entry->d_name);
cb8e9e
 
cb8e9e
                         offset = entry->d_off;
cb8e9e
                         if (gf_uuid_is_null (entry->d_stat.ia_gfid)) {
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING, "%s/%s: No "
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        AFR_MSG_GFID_NULL, "%s/%s: No "
cb8e9e
                                         "gfid present skipping",
cb8e9e
                                         loc->path, entry->d_name);
cb8e9e
                                 continue;
cb8e9e
@@ -508,35 +511,39 @@ gf_pump_traverse_directory (loc_t *loc)
cb8e9e
 				continue;
cb8e9e
 
cb8e9e
 			is_directory_empty = _gf_false;
cb8e9e
-			gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-				"lookup %s => %"PRId64,
cb8e9e
-				entry_loc.path,
cb8e9e
-				iatt.ia_ino);
cb8e9e
+	                gf_msg_debug (this->name, 0,
cb8e9e
+	                              "lookup %s => %"PRId64,
cb8e9e
+                                      entry_loc.path,
cb8e9e
+                                      iatt.ia_ino);
cb8e9e
 
cb8e9e
 			ret = syncop_lookup (this, &entry_loc, &iatt, &parent,
cb8e9e
 					     NULL, &xattr_rsp);
cb8e9e
 
cb8e9e
 			if (ret) {
cb8e9e
-				gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-					"%s: lookup failed", entry_loc.path);
cb8e9e
+			        gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                                        -ret, AFR_MSG_INFO_COMMON,
cb8e9e
+			                "%s: lookup failed", entry_loc.path);
cb8e9e
 				continue;
cb8e9e
 			}
cb8e9e
 
cb8e9e
 			ret = afr_selfheal_name (this, loc->gfid, entry->d_name,
cb8e9e
                                                  NULL);
cb8e9e
 			if (ret) {
cb8e9e
-				gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-					"%s: name self-heal failed (%s/%s)",
cb8e9e
-					entry_loc.path, uuid_utoa (loc->gfid),
cb8e9e
-					entry->d_name);
cb8e9e
+			        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        AFR_MSG_SELF_HEAL_FAILED,
cb8e9e
+			                "%s: name self-heal failed (%s/%s)",
cb8e9e
+			                entry_loc.path, uuid_utoa (loc->gfid),
cb8e9e
+				        entry->d_name);
cb8e9e
 				continue;
cb8e9e
 			}
cb8e9e
 
cb8e9e
 			ret = afr_selfheal (this, iatt.ia_gfid);
cb8e9e
 			if (ret < 0) {
cb8e9e
-				gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-					"%s: self-heal failed (%s)",
cb8e9e
-					entry_loc.path, uuid_utoa (iatt.ia_gfid));
cb8e9e
+			        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        AFR_MSG_SELF_HEAL_FAILED,
cb8e9e
+				        "%s: self-heal failed (%s)",
cb8e9e
+				        entry_loc.path,
cb8e9e
+                                        uuid_utoa (iatt.ia_gfid));
cb8e9e
 				continue;
cb8e9e
 			}
cb8e9e
 
cb8e9e
@@ -549,15 +556,16 @@ gf_pump_traverse_directory (loc_t *loc)
cb8e9e
 
cb8e9e
 			ret = pump_check_and_update_status (this);
cb8e9e
 			if (ret < 0) {
cb8e9e
-				gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-					"Pump beginning to exit out");
cb8e9e
+			        gf_msg_debug (this->name, 0,
cb8e9e
+			                      "Pump beginning to exit out");
cb8e9e
 				goto out;
cb8e9e
 			}
cb8e9e
 
cb8e9e
 			if (IA_ISDIR (iatt.ia_type)) {
cb8e9e
 				if (is_pump_traversal_allowed (this, entry_loc.path)) {
cb8e9e
-					gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-						"entering dir=%s", entry->d_name);
cb8e9e
+				        gf_msg_trace (this->name, 0,
cb8e9e
+				                      "entering dir=%s",
cb8e9e
+                                                      entry->d_name);
cb8e9e
 					gf_pump_traverse_directory (&entry_loc);
cb8e9e
 				}
cb8e9e
                         }
cb8e9e
@@ -565,19 +573,19 @@ gf_pump_traverse_directory (loc_t *loc)
cb8e9e
 
cb8e9e
                 gf_dirent_free (&entries);
cb8e9e
                 free_entries = _gf_false;
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE, "offset incremented to %d",
cb8e9e
-                        (int32_t ) offset);
cb8e9e
+                gf_msg_trace (this->name, 0, "offset incremented to %d",
cb8e9e
+                              (int32_t) offset);
cb8e9e
 
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = syncop_close (fd);
cb8e9e
         if (ret < 0)
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "closing the fd failed");
cb8e9e
+                gf_msg_debug (this->name, 0, "closing the fd failed");
cb8e9e
 
cb8e9e
         if (is_directory_empty && (strcmp (loc->path, "/") == 0)) {
cb8e9e
                pump_change_state (this, PUMP_STATE_RUNNING);
cb8e9e
-               gf_log (this->name, GF_LOG_INFO, "Empty source brick. "
cb8e9e
-                                "Nothing to be done.");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_INFO_COMMON,
cb8e9e
+                       "Empty source brick. Nothing to be done.");
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -596,13 +604,13 @@ pump_update_resume_path (xlator_t *this)
cb8e9e
         resume_path = pump_get_resume_path (this);
cb8e9e
 
cb8e9e
         if (resume_path) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Found a path to resume from: %s",
cb8e9e
-                        resume_path);
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Found a path to resume from: %s",
cb8e9e
+                              resume_path);
cb8e9e
 
cb8e9e
         }else {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Did not find a path=> setting to '/'");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Did not find a path=> setting to '/'");
cb8e9e
                 pump_set_resume_path (this, "/");
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -636,8 +644,8 @@ pump_xattr_cleaner (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 ret = syncop_removexattr (priv->children[i], &loc,
cb8e9e
                                           PUMP_SOURCE_COMPLETE, 0, NULL);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "removexattr "
cb8e9e
-                                "failed with %s", strerror (-ret));
cb8e9e
+                        gf_msg_debug (this->name, 0, "removexattr "
cb8e9e
+                                     "failed with %s", strerror (-ret));
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -667,41 +675,45 @@ pump_complete_migration (xlator_t *this)
cb8e9e
 
cb8e9e
         state = pump_get_state ();
cb8e9e
         if (state == PUMP_STATE_RUNNING) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Pump finished pumping");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Pump finished pumping");
cb8e9e
 
cb8e9e
                 pump_priv->pump_finished = _gf_true;
cb8e9e
 
cb8e9e
                 dict_ret = dict_set_str (dict, PUMP_SOURCE_COMPLETE, "jargon");
cb8e9e
                 if (dict_ret)
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, -dict_ret,
cb8e9e
+                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "%s: failed to set the key %s",
cb8e9e
                                 loc.path, PUMP_SOURCE_COMPLETE);
cb8e9e
 
cb8e9e
                 ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0,
cb8e9e
                                        NULL, NULL);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "setxattr failed - while  notifying source complete");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "setxattr failed - while "
cb8e9e
+                                      "notifying source complete");
cb8e9e
                 }
cb8e9e
                 dict_ret = dict_set_str (dict, PUMP_SINK_COMPLETE, "jargon");
cb8e9e
                 if (dict_ret)
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, -dict_ret,
cb8e9e
+                                AFR_MSG_DICT_SET_FAILED,
cb8e9e
                                 "%s: failed to set the key %s",
cb8e9e
                                 loc.path, PUMP_SINK_COMPLETE);
cb8e9e
 
cb8e9e
                 ret = syncop_setxattr (PUMP_SINK_CHILD (this), &loc, dict, 0,
cb8e9e
                                        NULL, NULL);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "setxattr failed - while notifying sink complete");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "setxattr failed - while "
cb8e9e
+                                      "notifying sink complete");
cb8e9e
                 }
cb8e9e
 
cb8e9e
                 pump_save_path (this, "/");
cb8e9e
 
cb8e9e
         } else if (state == PUMP_STATE_ABORT) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Starting cleanup "
cb8e9e
-                        "of pump internal xattrs");
cb8e9e
+                gf_msg_debug (this->name, 0, "Starting cleanup "
cb8e9e
+                              "of pump internal xattrs");
cb8e9e
                 call_resume (pump_priv->cleaner);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -730,8 +742,8 @@ pump_lookup_sink (loc_t *loc)
cb8e9e
                              xattr_req, &xattr_rsp);
cb8e9e
 
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Lookup on sink child failed");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Lookup on sink child failed");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -765,8 +777,8 @@ pump_task (void *data)
cb8e9e
         afr_build_root_loc (this, &loc;;
cb8e9e
         xattr_req = dict_new ();
cb8e9e
         if (!xattr_req) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Out of memory");
cb8e9e
+                gf_msg_debug (this->name, ENOMEM,
cb8e9e
+                              "Out of memory");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -775,9 +787,9 @@ pump_task (void *data)
cb8e9e
         ret = syncop_lookup (this, &loc, &iatt, &parent,
cb8e9e
                              xattr_req, &xattr_rsp);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                "lookup: path=%s gfid=%s",
cb8e9e
-                loc.path, uuid_utoa (loc.inode->gfid));
cb8e9e
+        gf_msg_trace (this->name, 0,
cb8e9e
+                      "lookup: path=%s gfid=%s",
cb8e9e
+                      loc.path, uuid_utoa (loc.inode->gfid));
cb8e9e
 
cb8e9e
         ret = pump_check_and_update_status (this);
cb8e9e
         if (ret < 0) {
cb8e9e
@@ -818,8 +830,8 @@ pump_task_completion (int ret, call_frame_t *sync_frame, void *data)
cb8e9e
         inode_unref (priv->root_inode);
cb8e9e
         STACK_DESTROY (sync_frame->root);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Pump xlator exiting");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Pump xlator exiting");
cb8e9e
 	return 0;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -841,15 +853,12 @@ pump_start (call_frame_t *pump_frame, xlator_t *this)
cb8e9e
                             pump_task_completion,
cb8e9e
                             pump_frame, NULL);
cb8e9e
         if (ret == -1) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "starting pump failed");
cb8e9e
-                pump_change_state (this, PUMP_STATE_ABORT);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "setting pump as started lk_owner: %s %"PRIu64,
cb8e9e
-                lkowner_utoa (&pump_frame->root->lk_owner), pump_pid);
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "setting pump as started lk_owner: %s %"PRIu64,
cb8e9e
+                      lkowner_utoa (&pump_frame->root->lk_owner), pump_pid);
cb8e9e
 
cb8e9e
         priv->use_afr_in_pump = 1;
cb8e9e
 out:
cb8e9e
@@ -864,8 +873,6 @@ pump_start_synctask (xlator_t *this)
cb8e9e
 
cb8e9e
         frame = create_frame (this, this->ctx->pool);
cb8e9e
         if (!frame) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Out of memory");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -893,16 +900,17 @@ pump_cmd_start_setxattr_cbk (call_frame_t *frame,
cb8e9e
         local = frame->local;
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        AFR_MSG_INFO_COMMON,
cb8e9e
                         "Could not initiate destination "
cb8e9e
                         "brick connect");
cb8e9e
                 ret = op_ret;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Successfully initiated destination "
cb8e9e
-                "brick connect");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Successfully initiated destination "
cb8e9e
+                      "brick connect");
cb8e9e
 
cb8e9e
         pump_mark_start_pending (this);
cb8e9e
 
cb8e9e
@@ -940,7 +948,8 @@ pump_initiate_sink_connect (call_frame_t *frame, xlator_t *this)
cb8e9e
         data = data_ref (dict_get (local->dict, RB_PUMP_CMD_START));
cb8e9e
         if (!data) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
cb8e9e
+                        AFR_MSG_DICT_GET_FAILED,
cb8e9e
                         "Could not get destination brick value");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -959,12 +968,13 @@ pump_initiate_sink_connect (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
         memcpy (clnt_cmd, data->data, data->len);
cb8e9e
         clnt_cmd[data->len] = '\0';
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Got destination brick %s\n",
cb8e9e
-                        clnt_cmd);
cb8e9e
+        gf_msg_debug (this->name, 0, "Got destination brick %s\n",
cb8e9e
+                      clnt_cmd);
cb8e9e
 
cb8e9e
         ret = dict_set_dynstr (dict, CLIENT_CMD_CONNECT, clnt_cmd);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
cb8e9e
+                        AFR_MSG_DICT_SET_FAILED,
cb8e9e
                         "Could not inititiate destination brick "
cb8e9e
                         "connect");
cb8e9e
                 goto out;
cb8e9e
@@ -1023,14 +1033,14 @@ pump_cmd_start_getxattr_cbk (call_frame_t *frame,
cb8e9e
         local = frame->local;
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "getxattr failed - changing pump "
cb8e9e
-                        "state to RUNNING with '/'");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "getxattr failed - changing pump "
cb8e9e
+                              "state to RUNNING with '/'");
cb8e9e
                 path = "/";
cb8e9e
                 ret = op_ret;
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "getxattr succeeded");
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
+                              "getxattr succeeded");
cb8e9e
 
cb8e9e
                 dict_ret =  dict_get_str (dict, PUMP_PATH, &path);
cb8e9e
                 if (dict_ret < 0)
cb8e9e
@@ -1040,7 +1050,8 @@ pump_cmd_start_getxattr_cbk (call_frame_t *frame,
cb8e9e
         state = pump_get_state ();
cb8e9e
         if ((state == PUMP_STATE_RUNNING) ||
cb8e9e
             (state == PUMP_STATE_RESUME)) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        0, AFR_MSG_PUMP_XLATOR_ERROR,
cb8e9e
                         "Pump is already started");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -1054,8 +1065,8 @@ pump_cmd_start_getxattr_cbk (call_frame_t *frame,
cb8e9e
         else {
cb8e9e
                 /* We're re-starting pump from a previous
cb8e9e
                    pause */
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "about to start synctask");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "about to start synctask");
cb8e9e
                 ret = pump_start_synctask (this);
cb8e9e
                 need_unwind = 1;
cb8e9e
         }
cb8e9e
@@ -1098,8 +1109,6 @@ pump_execute_status (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
         dict_str     = GF_CALLOC (1, PATH_MAX + 256, gf_afr_mt_char);
cb8e9e
         if (!dict_str) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Out of memory");
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = ENOMEM;
cb8e9e
                 goto out;
cb8e9e
@@ -1120,8 +1129,8 @@ pump_execute_status (call_frame_t *frame, xlator_t *this)
cb8e9e
 
cb8e9e
         ret = dict_set_dynstr (dict, RB_PUMP_CMD_STATUS, dict_str);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "dict_set_dynstr returned negative value");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "dict_set_dynstr returned negative value");
cb8e9e
         } else {
cb8e9e
                 dict_str = NULL;
cb8e9e
         }
cb8e9e
@@ -1168,7 +1177,8 @@ pump_execute_start (call_frame_t *frame, xlator_t *this)
cb8e9e
         local = frame->local;
cb8e9e
 
cb8e9e
         if (!priv->root_inode) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        0, AFR_MSG_PUMP_XLATOR_ERROR,
cb8e9e
                         "Pump xlator cannot be started without an initial "
cb8e9e
                         "lookup");
cb8e9e
                 ret = -1;
cb8e9e
@@ -1235,13 +1245,14 @@ pump_execute_commit (call_frame_t *frame, xlator_t *this)
cb8e9e
                 ret = synctask_new (pump_priv->env, pump_cleanup_helper,
cb8e9e
                                     pump_cleanup_done, sync_frame, frame);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "Couldn't create "
cb8e9e
-                                "synctask for cleaning up xattrs.");
cb8e9e
+                        gf_msg_debug (this->name, 0, "Couldn't create "
cb8e9e
+                                      "synctask for cleaning up xattrs.");
cb8e9e
                 }
cb8e9e
 
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Commit can't proceed. "
cb8e9e
-                        "Migration in progress");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, EINPROGRESS,
cb8e9e
+                        AFR_MSG_MIGRATION_IN_PROGRESS,
cb8e9e
+                        "Commit can't proceed. Migration in progress");
cb8e9e
                 local->op_ret = -1;
cb8e9e
                 local->op_errno = EINPROGRESS;
cb8e9e
                 pump_command_reply (frame, this);
cb8e9e
@@ -1277,8 +1288,8 @@ pump_execute_abort (call_frame_t *frame, xlator_t *this)
cb8e9e
                 ret = synctask_new (pump_priv->env, pump_cleanup_helper,
cb8e9e
                                     pump_cleanup_done, sync_frame, frame);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "Couldn't create "
cb8e9e
-                                "synctask for cleaning up xattrs.");
cb8e9e
+                        gf_msg_debug (this->name, 0, "Couldn't create "
cb8e9e
+                                      "synctask for cleaning up xattrs.");
cb8e9e
                 }
cb8e9e
 
cb8e9e
         } else {
cb8e9e
@@ -1299,14 +1310,14 @@ pump_command_status (xlator_t *this, dict_t *dict)
cb8e9e
 
cb8e9e
         dict_ret = dict_get_str (dict, RB_PUMP_CMD_STATUS, &cmd);
cb8e9e
         if (dict_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Not a pump status command");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Not a pump status command");
cb8e9e
                 ret = _gf_false;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Hit a pump command - status");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Hit a pump command - status");
cb8e9e
         ret = _gf_true;
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1323,14 +1334,14 @@ pump_command_pause (xlator_t *this, dict_t *dict)
cb8e9e
 
cb8e9e
         dict_ret = dict_get_str (dict, RB_PUMP_CMD_PAUSE, &cmd);
cb8e9e
         if (dict_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Not a pump pause command");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Not a pump pause command");
cb8e9e
                 ret = _gf_false;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Hit a pump command - pause");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Hit a pump command - pause");
cb8e9e
         ret = _gf_true;
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1347,14 +1358,14 @@ pump_command_commit (xlator_t *this, dict_t *dict)
cb8e9e
 
cb8e9e
         dict_ret = dict_get_str (dict, RB_PUMP_CMD_COMMIT, &cmd);
cb8e9e
         if (dict_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Not a pump commit command");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Not a pump commit command");
cb8e9e
                 ret = _gf_false;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Hit a pump command - commit");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Hit a pump command - commit");
cb8e9e
         ret = _gf_true;
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1371,14 +1382,14 @@ pump_command_abort (xlator_t *this, dict_t *dict)
cb8e9e
 
cb8e9e
         dict_ret = dict_get_str (dict, RB_PUMP_CMD_ABORT, &cmd);
cb8e9e
         if (dict_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Not a pump abort command");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Not a pump abort command");
cb8e9e
                 ret = _gf_false;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Hit a pump command - abort");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Hit a pump command - abort");
cb8e9e
         ret = _gf_true;
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1395,14 +1406,14 @@ pump_command_start (xlator_t *this, dict_t *dict)
cb8e9e
 
cb8e9e
         dict_ret = dict_get_str (dict, RB_PUMP_CMD_START, &cmd);
cb8e9e
         if (dict_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "Not a pump start command");
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
+                              "Not a pump start command");
cb8e9e
                 ret = _gf_false;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                "Hit a pump command - start");
cb8e9e
+        gf_msg_debug (this->name, 0,
cb8e9e
+                      "Hit a pump command - start");
cb8e9e
         ret = _gf_true;
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1438,8 +1449,8 @@ pump_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
cb8e9e
                 }
cb8e9e
 
cb8e9e
                 if (!strcmp (name, RB_PUMP_CMD_STATUS)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "Hit pump command - status");
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
+                                      "Hit pump command - status");
cb8e9e
                         pump_execute_status (frame, this);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -1461,10 +1472,12 @@ pump_command_reply (call_frame_t *frame, xlator_t *this)
cb8e9e
         local = frame->local;
cb8e9e
 
cb8e9e
         if (local->op_ret < 0)
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        0, AFR_MSG_INFO_COMMON,
cb8e9e
                         "Command failed");
cb8e9e
         else
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        0, AFR_MSG_INFO_COMMON,
cb8e9e
                         "Command succeeded");
cb8e9e
 
cb8e9e
         AFR_STACK_UNWIND (setxattr,
cb8e9e
@@ -2153,8 +2166,6 @@ mem_acct_init (xlator_t *this)
cb8e9e
         ret = xlator_mem_acct_init (this, gf_afr_mt_end + 1);
cb8e9e
 
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
cb8e9e
-                                "failed");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2193,13 +2204,13 @@ notify (xlator_t *this, int32_t event,
cb8e9e
         case GF_EVENT_CHILD_UP:
cb8e9e
                 if (is_xlator_pump_sink (child_xl))
cb8e9e
                         if (is_pump_start_pending (this)) {
cb8e9e
-                                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                        "about to start synctask");
cb8e9e
+                                gf_msg_debug (this->name, 0,
cb8e9e
+                                              "about to start synctask");
cb8e9e
                                 ret = pump_start_synctask (this);
cb8e9e
                                 if (ret < 0)
cb8e9e
-                                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                                "Could not start pump "
cb8e9e
-                                                "synctask");
cb8e9e
+                                        gf_msg_debug (this->name, 0,
cb8e9e
+                                                      "Could not start pump "
cb8e9e
+                                                      "synctask");
cb8e9e
                                 else
cb8e9e
                                         pump_remove_start_pending (this);
cb8e9e
                         }
cb8e9e
@@ -2222,15 +2233,16 @@ init (xlator_t *this)
cb8e9e
         int source_child = 0;
cb8e9e
 
cb8e9e
 	if (!this->children) {
cb8e9e
-		gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"pump translator needs a source and sink"
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        0, AFR_MSG_CHILD_MISCONFIGURED,
cb8e9e
+		        "pump translator needs a source and sink"
cb8e9e
                         "subvolumes defined.");
cb8e9e
 		return -1;
cb8e9e
 	}
cb8e9e
 
cb8e9e
 	if (!this->parents) {
cb8e9e
-		gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-			"Volume is dangling.");
cb8e9e
+	        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+		        AFR_MSG_VOL_MISCONFIGURED, "Volume is dangling.");
cb8e9e
 	}
cb8e9e
 
cb8e9e
 	priv = GF_CALLOC (1, sizeof (afr_private_t), gf_afr_mt_afr_private_t);
cb8e9e
@@ -2241,7 +2253,8 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         child_count = xlator_subvolume_count (this);
cb8e9e
         if (child_count != 2) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR,
cb8e9e
+                        0, AFR_MSG_CHILD_MISCONFIGURED,
cb8e9e
                         "There should be exactly 2 children - one source "
cb8e9e
                         "and one sink");
cb8e9e
                 return -1;
cb8e9e
@@ -2274,8 +2287,6 @@ init (xlator_t *this)
cb8e9e
 	priv->child_up = GF_CALLOC (sizeof (unsigned char), child_count,
cb8e9e
                                  gf_afr_mt_char);
cb8e9e
 	if (!priv->child_up) {
cb8e9e
-		gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Out of memory.");
cb8e9e
 		op_errno = ENOMEM;
cb8e9e
 		goto out;
cb8e9e
 	}
cb8e9e
@@ -2283,8 +2294,6 @@ init (xlator_t *this)
cb8e9e
 	priv->children = GF_CALLOC (sizeof (xlator_t *), child_count,
cb8e9e
                                  gf_afr_mt_xlator_t);
cb8e9e
 	if (!priv->children) {
cb8e9e
-		gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Out of memory.");
cb8e9e
 		op_errno = ENOMEM;
cb8e9e
 		goto out;
cb8e9e
 	}
cb8e9e
@@ -2293,8 +2302,6 @@ init (xlator_t *this)
cb8e9e
                                        child_count,
cb8e9e
                                        gf_afr_mt_char);
cb8e9e
         if (!priv->pending_key) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Out of memory.");
cb8e9e
                 op_errno = ENOMEM;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2308,8 +2315,6 @@ init (xlator_t *this)
cb8e9e
                                    AFR_XATTR_PREFIX,
cb8e9e
                                    trav->xlator->name);
cb8e9e
                 if (-1 == ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "asprintf failed to set pending key");
cb8e9e
                         op_errno = ENOMEM;
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -2336,8 +2341,6 @@ init (xlator_t *this)
cb8e9e
 	pump_priv = GF_CALLOC (1, sizeof (*pump_priv),
cb8e9e
                             gf_afr_mt_pump_priv);
cb8e9e
 	if (!pump_priv) {
cb8e9e
-		gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-			"Out of memory");
cb8e9e
                 op_errno = ENOMEM;
cb8e9e
 		goto out;
cb8e9e
 	}
cb8e9e
@@ -2348,15 +2351,12 @@ init (xlator_t *this)
cb8e9e
         pump_priv->resume_path = GF_CALLOC (1, PATH_MAX,
cb8e9e
                                             gf_afr_mt_char);
cb8e9e
         if (!pump_priv->resume_path) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Out of memory");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
 	pump_priv->env = this->ctx->env;
cb8e9e
         if (!pump_priv->env) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Could not create new sync-environment");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2365,8 +2365,6 @@ init (xlator_t *this)
cb8e9e
         this->local_pool = mem_pool_new (afr_local_t, 128);
cb8e9e
         if (!this->local_pool) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "failed to create local_t's memory pool");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e