Blob Blame History Raw
From 5c79ddf3d88bcc6d6492f7eae9eaa9931e338072 Mon Sep 17 00:00:00 2001
From: arao <arao@redhat.com>
Date: Mon, 22 Jun 2015 11:10:05 +0530
Subject: [PATCH 182/190] Logging: Porting the performance translator
          logs to new logging framework.

BUG: 1231784
Change-Id: Id7535930442f6fc67fbe0cd93308f8fda534aa6f
Signed-off-by: Anusha <arao@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51752
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
Tested-by: Nithya Balachandran <nbalacha@redhat.com>
---
 libglusterfs/src/glfs-message-id.h                 |   50 ++++++--
 .../performance/io-cache/src/io-cache-messages.h   |  111 +++++++++++++++
 xlators/performance/io-cache/src/io-cache.c        |  150 ++++++++++++--------
 xlators/performance/io-cache/src/io-cache.h        |   45 +++---
 xlators/performance/io-cache/src/ioc-inode.c       |   22 ++--
 xlators/performance/io-cache/src/page.c            |  103 +++++++-------
 .../io-threads/src/io-threads-messages.h           |  103 ++++++++++++++
 xlators/performance/io-threads/src/io-threads.c    |   56 +++++---
 .../performance/md-cache/src/md-cache-messages.h   |   66 +++++++++
 xlators/performance/md-cache/src/md-cache.c        |   13 +-
 .../open-behind/src/open-behind-messages.h         |   85 +++++++++++
 xlators/performance/open-behind/src/open-behind.c  |   15 ++-
 .../quick-read/src/quick-read-messages.h           |  119 ++++++++++++++++
 xlators/performance/quick-read/src/quick-read.c    |   41 +++---
 xlators/performance/read-ahead/src/page.c          |   11 +-
 .../read-ahead/src/read-ahead-messages.h           |   94 ++++++++++++
 xlators/performance/read-ahead/src/read-ahead.c    |   67 +++++----
 .../readdir-ahead/src/readdir-ahead-messages.h     |  105 ++++++++++++++
 .../performance/readdir-ahead/src/readdir-ahead.c  |   21 ++-
 .../symlink-cache/src/symlink-cache-messages.h     |   93 ++++++++++++
 .../performance/symlink-cache/src/symlink-cache.c  |   69 +++++----
 .../write-behind/src/write-behind-messages.h       |  121 ++++++++++++++++
 .../performance/write-behind/src/write-behind.c    |   26 +++-
 23 files changed, 1308 insertions(+), 278 deletions(-)
 create mode 100644 xlators/performance/io-cache/src/io-cache-messages.h
 create mode 100644 xlators/performance/io-threads/src/io-threads-messages.h
 create mode 100644 xlators/performance/md-cache/src/md-cache-messages.h
 create mode 100644 xlators/performance/open-behind/src/open-behind-messages.h
 create mode 100644 xlators/performance/quick-read/src/quick-read-messages.h
 create mode 100644 xlators/performance/read-ahead/src/read-ahead-messages.h
 create mode 100644 xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
 create mode 100644 xlators/performance/symlink-cache/src/symlink-cache-messages.h
 create mode 100644 xlators/performance/write-behind/src/write-behind-messages.h

diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
index 53b004d..0087440 100644
--- a/libglusterfs/src/glfs-message-id.h
+++ b/libglusterfs/src/glfs-message-id.h
@@ -109,17 +109,49 @@
 #define GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END    (GLFS_MSGID_COMP_RPC_TRANS_SOCKET + \
                                                 GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_QUOTA           GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END
-#define GLFS_MSGID_COMP_QUOTA_END       (GLFS_MSGID_COMP_QUOTA +\
-                                        GLFS_MSGID_SEGMENT)
-
-#define GLFS_MSGID_COMP_CTR                GLFS_MSGID_COMP_QUOTA_END
-#define GLFS_MSGID_COMP_CTR_END            (GLFS_MSGID_COMP_CTR+\
+#define GLFS_MSGID_COMP_QUOTA              GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END
+#define GLFS_MSGID_COMP_QUOTA_END          (GLFS_MSGID_COMP_QUOTA +\
                                            GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_EC               GLFS_MSGID_COMP_CTR_END
-#define GLFS_MSGID_COMP_EC_END           (GLFS_MSGID_COMP_EC +\
-                                         GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_IO_CACHE                GLFS_MSGID_COMP_EC_END
+#define GLFS_MSGID_COMP_IO_CACHE_END            (GLFS_MSGID_COMP_IO_CACHE+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_IO_THREADS              GLFS_MSGID_COMP_IO_CACHE_END
+#define GLFS_MSGID_COMP_IO_THREADS_END          (GLFS_MSGID_COMP_IO_THREADS+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_MD_CACHE                GLFS_MSGID_COMP_IO_THREADS_END
+#define GLFS_MSGID_COMP_MD_CACHE_END            (GLFS_MSGID_COMP_MD_CACHE+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_OPEN_BEHIND             GLFS_MSGID_COMP_MD_CACHE_END
+#define GLFS_MSGID_COMP_OPEN_BEHIND_END         (GLFS_MSGID_COMP_OPEN_BEHIND+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_QUICK_READ              GLFS_MSGID_COMP_OPEN_BEHIND_END
+#define GLFS_MSGID_COMP_QUICK_READ_END          (GLFS_MSGID_COMP_QUICK_READ+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_READ_AHEAD              GLFS_MSGID_COMP_QUICK_READ_END
+#define GLFS_MSGID_COMP_READ_AHEAD_END          (GLFS_MSGID_COMP_READ_AHEAD+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_READDIR_AHEAD           GLFS_MSGID_COMP_READ_AHEAD_END
+#define GLFS_MSGID_COMP_READDIR_AHEAD_END       (GLFS_MSGID_COMP_READDIR_AHEAD+\
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_SYMLINK_CACHE           \
+GLFS_MSGID_COMP_READDIR_AHEAD_END
+#define GLFS_MSGID_COMP_SYMLINK_CACHE_END \
+(GLFS_MSGID_COMP_SYMLINK_CACHE+ \
+                                                GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_WRITE_BEHIND             \
+GLFS_MSGID_COMP_SYMLINK_CACHE_END
+#define GLFS_MSGID_COMP_WRITE_BEHIND_END        (GLFS_MSGID_COMP_WRITE_BEHIND+\
+                                                GLFS_MSGID_SEGMENT)
 
 /* --- new segments for messages goes above this line --- */
 
diff --git a/xlators/performance/io-cache/src/io-cache-messages.h b/xlators/performance/io-cache/src/io-cache-messages.h
new file mode 100644
index 0000000..5c4fbea
--- /dev/null
+++ b/xlators/performance/io-cache/src/io-cache-messages.h
@@ -0,0 +1,111 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _IO_CACHE_MESSAGES_H_
+#define _IO_CACHE_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file io-cache-messages.h
+ *  \brief IO_CACHE log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_IO_CACHE_BASE                   GLFS_MSGID_COMP_IO_CACHE
+#define GLFS_IO_CACHE_NUM_MESSAGES           6
+#define GLFS_MSGID_END  (GLFS_IO_CACHE_BASE + GLFS_IO_CACHE_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_IO_CACHE_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_ENFORCEMENT_FAILED        (GLFS_IO_CACHE_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_INVALID_ARGUMENT        (GLFS_IO_CACHE_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED        (GLFS_IO_CACHE_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_NO_MEMORY        (GLFS_IO_CACHE_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_VOL_MISCONFIGURED        (GLFS_IO_CACHE_BASE + 5)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_CACHE_MSG_INODE_NULL        (GLFS_IO_CACHE_BASE + 6)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _IO_CACHE_MESSAGES_H_ */
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index bfda85d..7eea867 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -22,7 +22,7 @@
 #include "statedump.h"
 #include <assert.h>
 #include <sys/time.h>
-
+#include "io-cache-messages.h"
 int ioc_log2_page_size;
 
 uint32_t
@@ -272,14 +272,16 @@ ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
                 op_errno = ENOMEM;
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto unwind;
         }
 
         ret = loc_copy (&local->file_loc, loc);
         if (ret != 0) {
                 op_errno = ENOMEM;
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto unwind;
         }
 
@@ -360,9 +362,9 @@ ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
 
         if ((op_ret == -1) ||
             ((op_ret >= 0) && !ioc_cache_still_valid(ioc_inode, stbuf))) {
-                gf_log (ioc_inode->table->xl->name, GF_LOG_DEBUG,
-                        "cache for inode(%p) is invalid. flushing all pages",
-                        ioc_inode);
+                gf_msg_debug (ioc_inode->table->xl->name, 0,
+                              "cache for inode(%p) is invalid. flushing all pages",
+                              ioc_inode);
                 /* NOTE: only pages with no waiting frames are flushed by
                  * ioc_inode_flush. page_fault will be generated for all
                  * the pages which have waiting frames by ioc_inode_wakeup()
@@ -430,7 +432,8 @@ ioc_wait_on_inode (ioc_inode_t *ioc_inode, ioc_page_t *page)
                 waiter = GF_CALLOC (1, sizeof (ioc_waitq_t),
                                     gf_ioc_mt_ioc_waitq_t);
                 if (waiter == NULL) {
-                        gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
+                        gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
+                                ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                 "out of memory");
                         ret = -ENOMEM;
                         goto out;
@@ -468,8 +471,8 @@ ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
                 ret = -1;
                 local->op_ret = -1;
                 local->op_errno = ENOMEM;
-                gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
-                        "out of memory");
+                gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
+                        0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto out;
         }
 
@@ -479,8 +482,8 @@ ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
                 local->op_ret = -1;
                 local->op_errno = ENOMEM;
                 mem_put (validate_local);
-                gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
-                        "out of memory");
+                gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
+                        0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto out;
         }
 
@@ -560,8 +563,10 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
 
                 //TODO: see why inode context is NULL and handle it.
                 if (!ioc_inode) {
-                        gf_log (this->name, GF_LOG_ERROR, "inode context is "
-                                "NULL (%s)", uuid_utoa (fd->inode->gfid));
+                        gf_msg (this->name, GF_LOG_ERROR,
+                                EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
+                                "inode context is NULL (%s)",
+                                uuid_utoa (fd->inode->gfid));
                         goto out;
                 }
 
@@ -660,7 +665,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                                 && (table->max_file_size < ioc_inode->ia_size))) {
                                 ret = fd_ctx_set (fd, this, 1);
                                 if (ret)
-                                        gf_log (this->name, GF_LOG_WARNING,
+                                        gf_msg (this->name, GF_LOG_WARNING,
+                                                ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                                 "%s: failed to set fd ctx",
                                                 local->file_loc.path);
                         }
@@ -677,7 +683,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                          * as a whole */
                         ret = fd_ctx_set (fd, this, 1);
                         if (ret)
-                                gf_log (this->name, GF_LOG_WARNING,
+                                gf_msg (this->name, GF_LOG_WARNING,
+                                        ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                         "%s: failed to set fd ctx",
                                         local->file_loc.path);
                 }
@@ -687,7 +694,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                         /* we allow a pattern-matched cache disable this way */
                         ret = fd_ctx_set (fd, this, 1);
                         if (ret)
-                                gf_log (this->name, GF_LOG_WARNING,
+                                gf_msg (this->name, GF_LOG_WARNING,
+                                        ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                         "%s: failed to set fd ctx",
                                         local->file_loc.path);
                 }
@@ -767,14 +775,16 @@ ioc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
                 op_errno = ENOMEM;
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto unwind;
         }
 
         ret = loc_copy (&local->file_loc, loc);
         if (ret != 0) {
                 op_errno = ENOMEM;
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto unwind;
         }
 
@@ -816,7 +826,8 @@ ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
 
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, NULL, NULL);
                 return 0;
         }
@@ -852,7 +863,8 @@ ioc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
 
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, NULL, NULL,
                                      NULL, NULL, NULL, NULL);
                 return 0;
@@ -991,8 +1003,9 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
                                                           trav_offset);
                                 fault = 1;
                                 if (!trav) {
-                                        gf_log (frame->this->name,
+                                        gf_msg (frame->this->name,
                                                 GF_LOG_CRITICAL,
+                                                ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                                 "out of memory");
                                         local->op_ret = -1;
                                         local->op_errno = ENOMEM;
@@ -1008,10 +1021,13 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
                                 /* page found in cache */
                                 if (!might_need_validate && !ioc_inode->waitq) {
                                         /* fresh enough */
-                                        gf_log (frame->this->name, GF_LOG_TRACE,
-                                                "cache hit for trav_offset=%"
-                                                PRId64"/local_offset=%"PRId64"",
-                                                trav_offset, local_offset);
+                                        gf_msg_trace (frame->this->name, 0,
+                                                      "cache hit for "
+                                                      "trav_offset=%"
+                                                      PRId64"/local_"
+                                                      "offset=%"PRId64"",
+                                                      trav_offset,
+                                                      local_offset);
                                         waitq = __ioc_page_wakeup (trav,
                                                                    trav->op_errno);
                                 } else {
@@ -1055,10 +1071,10 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
 
                 if (need_validate) {
                         need_validate = 0;
-                        gf_log (frame->this->name, GF_LOG_TRACE,
-                                "sending validate request for "
-                                "inode(%s) at offset=%"PRId64"",
-                                uuid_utoa (fd->inode->gfid), trav_offset);
+                        gf_msg_trace (frame->this->name, 0,
+                                      "sending validate request for "
+                                      "inode(%s) at offset=%"PRId64"",
+                                      uuid_utoa (fd->inode->gfid), trav_offset);
                         ret = ioc_cache_validate (frame, ioc_inode, fd, trav);
                         if (ret == -1) {
                                 ioc_inode_lock (ioc_inode);
@@ -1128,7 +1144,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
         table = this->private;
 
         if (!table) {
-                gf_log (this->name, GF_LOG_ERROR, "table is null");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        IO_CACHE_MSG_ENFORCEMENT_FAILED, "table is null");
                 op_errno = EINVAL;
                 goto out;
         }
@@ -1162,7 +1179,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
 
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 op_errno = ENOMEM;
                 goto out;
         }
@@ -1176,9 +1194,10 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
         local->size = size;
         local->inode = ioc_inode;
 
-        gf_log (this->name, GF_LOG_TRACE,
-                "NEW REQ (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET"",
-                frame, offset, size);
+        gf_msg_trace (this->name, 0,
+                      "NEW REQ (%p) offset "
+                      "= %"PRId64" && size = %"GF_PRI_SIZET"",
+                      frame, offset, size);
 
         weight = ioc_inode->weight;
 
@@ -1248,7 +1267,8 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
 
         local = mem_get0 (this->local_pool);
         if (local == NULL) {
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
 
                 STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL, NULL);
                 return 0;
@@ -1383,8 +1403,8 @@ ioc_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
         inode_ctx_get (fd->inode, this, &tmp_inode);
         ioc_inode = (ioc_inode_t *)(long)tmp_inode;
         if (!ioc_inode) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "inode context is NULL: returning EBADFD");
+                gf_msg_debug (this->name, EBADFD,
+                              "inode context is NULL: returning EBADFD");
                 STACK_UNWIND_STRICT (lk, frame, -1, EBADFD, NULL, NULL);
                 return 0;
         }
@@ -1537,10 +1557,9 @@ ioc_get_priority_list (const char *opt_str, struct list_head *first)
                         goto out;
                 }
 
-                gf_log ("io-cache", GF_LOG_TRACE,
-                        "ioc priority : pattern %s : priority %s",
-                        pattern,
-                        priority);
+                gf_msg_trace ("io-cache", 0,
+                              "ioc priority : pattern %s : priority %s",
+                              pattern, priority);
 
                 curr->pattern = gf_strdup (pattern);
                 if (curr->pattern == NULL) {
@@ -1588,8 +1607,9 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_ioc_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
-                        "failed");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -1609,7 +1629,8 @@ check_cache_size_ok (xlator_t *this, uint64_t cache_size)
         opt = xlator_volume_option_get (this, "cache-size");
         if (!opt) {
                 ret = _gf_false;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR,
+                        EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
                         "could not get cache-size option");
                 goto out;
         }
@@ -1620,12 +1641,14 @@ check_cache_size_ok (xlator_t *this, uint64_t cache_size)
         else
                 max_cache_size = total_mem;
 
-        gf_log (this->name, GF_LOG_DEBUG, "Max cache size is %"PRIu64,
-                max_cache_size);
+        gf_msg_debug (this->name, 0, "Max cache size is %"PRIu64,
+                      max_cache_size);
 
         if (cache_size > max_cache_size) {
                 ret = _gf_false;
-                gf_log (this->name, GF_LOG_ERROR, "Cache size %"PRIu64
+                gf_msg (this->name, GF_LOG_ERROR,
+                        0, IO_CACHE_MSG_INVALID_ARGUMENT,
+                        "Cache size %"PRIu64
                         " is greater than the max size of %"PRIu64,
                         cache_size, max_cache_size);
                 goto out;
@@ -1655,8 +1678,8 @@ reconfigure (xlator_t *this, dict_t *options)
                 if (data) {
                         char *option_list = data_to_str (data);
 
-                        gf_log (this->name, GF_LOG_TRACE,
-                                "option path %s", option_list);
+                        gf_msg_trace (this->name, 0,
+                                      "option path %s", option_list);
                         /* parse the list of pattern:priority */
                         table->max_pri = ioc_get_priority_list (option_list,
                                                                 &table->priority_list);
@@ -1675,7 +1698,8 @@ reconfigure (xlator_t *this, dict_t *options)
 
                 if ((table->max_file_size <= UINT64_MAX) &&
                     (table->min_file_size > table->max_file_size)) {
-                        gf_log (this->name, GF_LOG_ERROR, "minimum size (%"
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                IO_CACHE_MSG_INVALID_ARGUMENT, "minimum size (%"
                                 PRIu64") of a file that can be cached is "
                                 "greater than maximum size (%"PRIu64"). "
                                 "Hence Defaulting to old value",
@@ -1687,7 +1711,8 @@ reconfigure (xlator_t *this, dict_t *options)
                                   options, size_uint64, unlock);
                 if (!check_cache_size_ok (this, cache_size_new)) {
                         ret = -1;
-                        gf_log (this->name, GF_LOG_ERROR,
+                        gf_msg (this->name, GF_LOG_ERROR,
+                                0, IO_CACHE_MSG_INVALID_ARGUMENT,
                                 "Not reconfiguring cache-size");
                         goto unlock;
                 }
@@ -1721,20 +1746,23 @@ init (xlator_t *this)
         xl_options = this->options;
 
         if (!this->children || this->children->next) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: io-cache not configured with exactly "
                         "one child");
                 goto out;
         }
 
         if (!this->parents) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        IO_CACHE_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfile ");
         }
 
         table = (void *) GF_CALLOC (1, sizeof (*table), gf_ioc_mt_ioc_table_t);
         if (table == NULL) {
-                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        IO_CACHE_MSG_NO_MEMORY, "out of memory");
                 goto out;
         }
 
@@ -1759,8 +1787,8 @@ init (xlator_t *this)
         data = dict_get (xl_options, "priority");
         if (data) {
                 char *option_list = data_to_str (data);
-                gf_log (this->name, GF_LOG_TRACE,
-                        "option path %s", option_list);
+                gf_msg_trace (this->name, 0,
+                              "option path %s", option_list);
                 /* parse the list of pattern:priority */
                 table->max_pri = ioc_get_priority_list (option_list,
                                                         &table->priority_list);
@@ -1775,7 +1803,8 @@ init (xlator_t *this)
 
         if ((table->max_file_size <= UINT64_MAX)
             && (table->min_file_size > table->max_file_size)) {
-                gf_log ("io-cache", GF_LOG_ERROR, "minimum size (%"
+                gf_msg ("io-cache", GF_LOG_ERROR, 0,
+                        IO_CACHE_MSG_INVALID_ARGUMENT, "minimum size (%"
                         PRIu64") of a file that can be cached is "
                         "greater than maximum size (%"PRIu64")",
                         table->min_file_size, table->max_file_size);
@@ -1795,7 +1824,8 @@ init (xlator_t *this)
         this->local_pool = mem_pool_new (ioc_local_t, 64);
         if (!this->local_pool) {
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                         "failed to create local_t's memory pool");
                 goto out;
         }
@@ -1809,8 +1839,8 @@ init (xlator_t *this)
 
         table->mem_pool = mem_pool_new (rbthash_entry_t, num_pages);
         if (!table->mem_pool) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "Unable to allocate mem_pool");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        IO_CACHE_MSG_NO_MEMORY, "Unable to allocate mem_pool");
                 goto out;
         }
 
diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h
index 46d758a..1bdd66b 100644
--- a/xlators/performance/io-cache/src/io-cache.h
+++ b/xlators/performance/io-cache/src/io-cache.h
@@ -29,6 +29,7 @@
 #include "hashfn.h"
 #include <sys/time.h>
 #include <fnmatch.h>
+#include "io-cache-messages.h"
 
 #define IOC_PAGE_SIZE    (1024 * 128)   /* 128KB */
 #define IOC_CACHE_SIZE   (32 * 1024 * 1024)
@@ -224,64 +225,64 @@ ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
 
 #define ioc_inode_lock(ioc_inode)                                       \
         do {                                                            \
-                gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,       \
-                        "locked inode(%p)", ioc_inode);                 \
+                gf_msg_trace (ioc_inode->table->xl->name, 0,            \
+                              "locked inode(%p)", ioc_inode);           \
                 pthread_mutex_lock (&ioc_inode->inode_lock);            \
         } while (0)
 
 
 #define ioc_inode_unlock(ioc_inode)                                     \
         do {                                                            \
-                gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,       \
-                        "unlocked inode(%p)", ioc_inode);               \
+                gf_msg_trace (ioc_inode->table->xl->name, 0,            \
+                              "unlocked inode(%p)", ioc_inode);         \
                 pthread_mutex_unlock (&ioc_inode->inode_lock);          \
         } while (0)
 
 
-#define ioc_table_lock(table)                                   \
-        do {                                                    \
-                gf_log (table->xl->name, GF_LOG_TRACE,          \
-                        "locked table(%p)", table);             \
-                pthread_mutex_lock (&table->table_lock);        \
+#define ioc_table_lock(table)                                           \
+        do {                                                            \
+                gf_msg_trace (table->xl->name, 0,                       \
+                              "locked table(%p)", table);               \
+                pthread_mutex_lock (&table->table_lock);                \
         } while (0)
 
 
-#define ioc_table_unlock(table)                                 \
-        do {                                                    \
-                gf_log (table->xl->name, GF_LOG_TRACE,          \
-                        "unlocked table(%p)", table);           \
-                pthread_mutex_unlock (&table->table_lock);      \
+#define ioc_table_unlock(table)                                         \
+        do {                                                            \
+                gf_msg_trace (table->xl->name, 0,                       \
+                              "unlocked table(%p)", table);             \
+                pthread_mutex_unlock (&table->table_lock);              \
         } while (0)
 
 
 #define ioc_local_lock(local)                                           \
         do {                                                            \
-                gf_log (local->inode->table->xl->name, GF_LOG_TRACE,    \
-                        "locked local(%p)", local);                     \
+                gf_msg_trace (local->inode->table->xl->name, 0,         \
+                              "locked local(%p)", local);               \
                 pthread_mutex_lock (&local->local_lock);                \
         } while (0)
 
 
 #define ioc_local_unlock(local)                                         \
         do {                                                            \
-                gf_log (local->inode->table->xl->name, GF_LOG_TRACE,    \
-                        "unlocked local(%p)", local);                   \
+                gf_msg_trace (local->inode->table->xl->name, 0,         \
+                              "unlocked local(%p)", local);             \
                 pthread_mutex_unlock (&local->local_lock);              \
         } while (0)
 
 
 #define ioc_page_lock(page)                                             \
         do {                                                            \
-                gf_log (page->inode->table->xl->name, GF_LOG_TRACE,     \
-                        "locked page(%p)", page);                       \
+                gf_msg_trace (page->inode->table->xl->name, 0,          \
+                              "locked page(%p)", page);                 \
                 pthread_mutex_lock (&page->page_lock);                  \
         } while (0)
 
 
 #define ioc_page_unlock(page)                                           \
         do {                                                            \
-                gf_log (page->inode->table->xl->name, GF_LOG_TRACE,     \
-                        "unlocked page(%p)", page);                     \
+                gf_msg_trace (page->inode->table->xl->name, 0,          \
+                              "unlocked page(%p)", page);               \
                 pthread_mutex_unlock (&page->page_lock);                \
         } while (0)
 
diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c
index 86a54bb..fcaab96 100644
--- a/xlators/performance/io-cache/src/ioc-inode.c
+++ b/xlators/performance/io-cache/src/ioc-inode.c
@@ -82,7 +82,8 @@ ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode,
         if (ioc_inode == NULL) {
                 local->op_ret = -1;
                 local->op_errno = EINVAL;
-                gf_log (frame->this->name, GF_LOG_WARNING, "ioc_inode is NULL");
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        IO_CACHE_MSG_INODE_NULL, "ioc_inode is NULL");
                 goto out;
         }
 
@@ -130,12 +131,15 @@ ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode,
                                                 waiter_page->ready = 0;
                                                 need_fault = 1;
                                         } else {
-                                                gf_log (frame->this->name,
-                                                        GF_LOG_TRACE,
-                                                        "validate frame(%p) is "
-                                                        "waiting for in-transit"
-                                                        " page = %p", frame,
-                                                        waiter_page);
+                                                gf_msg_trace (frame->this->name,
+                                                              0,
+                                                              "validate "
+                                                              "frame(%p) is "
+                                                              "waiting for "
+                                                              "in-transit"
+                                                              " page = %p",
+                                                              frame,
+                                                              waiter_page);
                                         }
                                 }
                                 ioc_inode_unlock (ioc_inode);
@@ -198,8 +202,8 @@ ioc_inode_update (ioc_table_t *table, inode_t *inode, uint32_t weight)
         }
         ioc_table_unlock (table);
 
-        gf_log (table->xl->name, GF_LOG_TRACE,
-                "adding to inode_lru[%d]", weight);
+        gf_msg_trace (table->xl->name, 0,
+                      "adding to inode_lru[%d]", weight);
 
 out:
         return ioc_inode;
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 416cd5f..4019ec0 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -21,7 +21,7 @@
 #include "ioc-mem-types.h"
 #include <assert.h>
 #include <sys/time.h>
-
+#include "io-cache-messages.h"
 char
 ioc_empty (struct ioc_cache *cache)
 {
@@ -108,10 +108,10 @@ __ioc_page_destroy (ioc_page_t *page)
                                 sizeof (page->offset));
                 list_del (&page->page_lru);
 
-                gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
-                        "destroying page = %p, offset = %"PRId64" "
-                        "&& inode = %p",
-                        page, page->offset, page->inode);
+                gf_msg_trace (page->inode->table->xl->name, 0,
+                              "destroying page = %p, offset = %"PRId64" "
+                              "&& inode = %p",
+                              page, page->offset, page->inode);
 
                 if (page->vector){
                         iobref_unref (page->iobref);
@@ -174,10 +174,11 @@ __ioc_inode_prune (ioc_inode_t *curr, uint64_t *size_pruned,
                 if (ret != -1)
                         table->cache_used -= ret;
 
-                gf_log (table->xl->name, GF_LOG_TRACE,
-                        "index = %d && table->cache_used = %"PRIu64" && table->"
-                        "cache_size = %"PRIu64, index, table->cache_used,
-                        table->cache_size);
+                gf_msg_trace (table->xl->name, 0,
+                              "index = %d && "
+                              "table->cache_used = %"PRIu64" && table->"
+                              "cache_size = %"PRIu64, index, table->cache_used,
+                              table->cache_size);
 
                 if ((*size_pruned) >= size_to_prune)
                         break;
@@ -284,8 +285,8 @@ __ioc_page_create (ioc_inode_t *ioc_inode, off_t offset)
 
         page = newpage;
 
-        gf_log ("io-cache", GF_LOG_TRACE,
-                "returning new page %p", page);
+        gf_msg_trace ("io-cache", 0,
+                      "returning new page %p", page);
 
 out:
         return page;
@@ -315,7 +316,8 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
         if (page == NULL) {
                 local->op_ret = -1;
                 local->op_errno = ENOMEM;
-                gf_log (frame->this->name, GF_LOG_WARNING,
+                gf_msg (frame->this->name, GF_LOG_WARNING,
+                        0, IO_CACHE_MSG_NO_MEMORY,
                         "asked to wait on a NULL page");
                 goto out;
         }
@@ -327,10 +329,10 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
                 goto out;
         }
 
-        gf_log (frame->this->name, GF_LOG_TRACE,
-                "frame(%p) waiting on page = %p, offset=%"PRId64", "
-                "size=%"GF_PRI_SIZET"",
-                frame, page, offset, size);
+        gf_msg_trace (frame->this->name, 0,
+                      "frame(%p) waiting on page = %p, offset=%"PRId64", "
+                      "size=%"GF_PRI_SIZET"",
+                      frame, page, offset, size);
 
         waitq->data = frame;
         waitq->next = page->waitq;
@@ -444,9 +446,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                 if (op_ret == -1 || !(zero_filled ||
                                       ioc_cache_still_valid(ioc_inode,
                                                             stbuf))) {
-                        gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
-                                "cache for inode(%p) is invalid. flushing "
-                                "all pages", ioc_inode);
+                        gf_msg_trace (ioc_inode->table->xl->name, 0,
+                                      "cache for inode(%p) is invalid. flushing "
+                                      "all pages", ioc_inode);
                         destroy_size = __ioc_inode_flush (ioc_inode);
                 }
 
@@ -464,8 +466,8 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                                 waitq = __ioc_page_error (page, op_ret,
                                                           op_errno);
                 } else {
-                        gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
-                                "op_ret = %d", op_ret);
+                        gf_msg_trace (ioc_inode->table->xl->name, 0,
+                                      "op_ret = %d", op_ret);
                         page = __ioc_page_get (ioc_inode, offset);
                         if (!page) {
                                 /* page was flushed */
@@ -500,8 +502,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                                 } else {
                                         /* TODO: we have got a response to
                                          * our request and no data */
-                                        gf_log (frame->this->name,
+                                        gf_msg (frame->this->name,
                                                 GF_LOG_CRITICAL,
+                                                ENOMEM, IO_CACHE_MSG_NO_MEMORY,
                                                 "frame>root>rsp_refs is null");
                                 } /* if(frame->root->rsp_refs) */
 
@@ -553,8 +556,8 @@ unlock:
                 ioc_prune (ioc_inode->table);
         }
 
-        gf_log (frame->this->name, GF_LOG_TRACE, "fault frame %p returned",
-                frame);
+        gf_msg_trace (frame->this->name, 0, "fault frame %p returned",
+                      frame);
         pthread_mutex_destroy (&local->local_lock);
 
         fd_unref (local->fd);
@@ -588,7 +591,8 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
         if (frame == NULL) {
                 op_ret = -1;
                 op_errno = EINVAL;
-                gf_log ("io-cache", GF_LOG_WARNING,
+                gf_msg ("io-cache", GF_LOG_WARNING,
+                        EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
                         "page fault on a NULL frame");
                 goto err;
         }
@@ -622,9 +626,9 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
         fault_local->pending_size = table->page_size;
         fault_local->inode = ioc_inode;
 
-        gf_log (frame->this->name, GF_LOG_TRACE,
-                "stack winding page fault for offset = %"PRId64" with "
-                "frame %p", offset, fault_frame);
+        gf_msg_trace (frame->this->name, 0,
+                      "stack winding page fault for offset = %"PRId64" with "
+                      "frame %p", offset, fault_frame);
 
         STACK_WIND (fault_frame, ioc_fault_cbk, FIRST_CHILD(fault_frame->this),
                     FIRST_CHILD(fault_frame->this)->fops->readv, fd,
@@ -667,7 +671,8 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
         GF_VALIDATE_OR_GOTO (frame->this->name, local, out);
 
         if (page == NULL) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        IO_CACHE_MSG_ENFORCEMENT_FAILED,
                         "NULL page has been provided to serve read request");
                 local->op_ret = -1;
                 local->op_errno = EINVAL;
@@ -676,10 +681,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
 
         ioc_inode = page->inode;
 
-        gf_log (frame->this->name, GF_LOG_TRACE,
-                "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
-                "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
-                frame, offset, size, page->size, local->wait_count);
+        gf_msg_trace (frame->this->name, 0,
+                      "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
+                      "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
+                      frame, offset, size, page->size, local->wait_count);
 
         /* immediately move this page to the end of the page_lru list */
         list_move_tail (&page->page_lru, &ioc_inode->cache.page_lru);
@@ -713,10 +718,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
                         copy_size = src_offset = 0;
                 }
 
-                gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
-                        "copy_size = %"GF_PRI_SIZET" && src_offset = "
-                        "%"PRId64" && dst_offset = %"PRId64"",
-                        copy_size, src_offset, dst_offset);
+                gf_msg_trace (page->inode->table->xl->name, 0,
+                              "copy_size = %"GF_PRI_SIZET" && src_offset = "
+                              "%"PRId64" && dst_offset = %"PRId64"",
+                              copy_size, src_offset, dst_offset);
 
                 {
                         new = GF_CALLOC (1, sizeof (*new),
@@ -814,8 +819,8 @@ ioc_frame_unwind (call_frame_t *frame)
 
         local = frame->local;
         if (local == NULL) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "local is NULL");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOMEM,
+                        IO_CACHE_MSG_NO_MEMORY, "local is NULL");
                 op_ret = -1;
                 op_errno = ENOMEM;
                 goto unwind;
@@ -835,10 +840,10 @@ ioc_frame_unwind (call_frame_t *frame)
         }
 
         if (list_empty (&local->fill_list)) {
-                gf_log (frame->this->name, GF_LOG_TRACE,
-                        "frame(%p) has 0 entries in local->fill_list "
-                        "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
-                        frame, local->offset, local->size);
+                gf_msg_trace (frame->this->name, 0,
+                              "frame(%p) has 0 entries in local->fill_list "
+                              "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
+                              frame, local->offset, local->size);
         }
 
         list_for_each_entry (fill, &local->fill_list, list) {
@@ -876,8 +881,8 @@ ioc_frame_unwind (call_frame_t *frame)
         }
 
 unwind:
-        gf_log (frame->this->name, GF_LOG_TRACE,
-                "frame(%p) unwinding with op_ret=%d", frame, op_ret);
+        gf_msg_trace (frame->this->name, 0,
+                      "frame(%p) unwinding with op_ret=%d", frame, op_ret);
 
         //  ioc_local_unlock (local);
 
@@ -951,8 +956,8 @@ __ioc_page_wakeup (ioc_page_t *page, int32_t op_errno)
 
         page->ready = 1;
 
-        gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
-                "page is %p && waitq = %p", page, waitq);
+        gf_msg_trace (page->inode->table->xl->name, 0,
+                      "page is %p && waitq = %p", page, waitq);
 
         for (trav = waitq; trav; trav = trav->next) {
                 frame = trav->data;
@@ -994,8 +999,8 @@ __ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno)
         waitq = page->waitq;
         page->waitq = NULL;
 
-        gf_log (page->inode->table->xl->name, GF_LOG_DEBUG,
-                "page error for page = %p & waitq = %p", page, waitq);
+        gf_msg_debug (page->inode->table->xl->name, 0,
+                      "page error for page = %p & waitq = %p", page, waitq);
 
         for (trav = waitq; trav; trav = trav->next) {
 
diff --git a/xlators/performance/io-threads/src/io-threads-messages.h b/xlators/performance/io-threads/src/io-threads-messages.h
new file mode 100644
index 0000000..ab1f672
--- /dev/null
+++ b/xlators/performance/io-threads/src/io-threads-messages.h
@@ -0,0 +1,103 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _IO_THREADS_MESSAGES_H_
+#define _IO_THREADS_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file io-threads-messages.h
+ *  \brief IO_THREADS log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_IO_THREADS_BASE                   GLFS_MSGID_COMP_IO_THREADS
+#define GLFS_IO_THREADS_NUM_MESSAGES           5
+#define GLFS_MSGID_END (GLFS_IO_THREADS_BASE + \
+        GLFS_IO_THREADS_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_IO_THREADS_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_THREADS_MSG_INIT_FAILED        (GLFS_IO_THREADS_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED  (GLFS_IO_THREADS_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_THREADS_MSG_NO_MEMORY        (GLFS_IO_THREADS_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_THREADS_MSG_VOL_MISCONFIGURED        (GLFS_IO_THREADS_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define IO_THREADS_MSG_SIZE_NOT_SET        (GLFS_IO_THREADS_BASE + 5)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _IO_THREADS_MESSAGES_H_ */
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 148e55a..0234587 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -24,6 +24,7 @@
 #include <sys/time.h>
 #include <time.h>
 #include "locking.h"
+#include "io-threads-messages.h"
 
 void *iot_worker (void *arg);
 int iot_workers_scale (iot_conf_t *conf);
@@ -192,9 +193,9 @@ iot_worker (void *data)
                                 if (conf->curr_count > IOT_MIN_THREADS) {
                                         conf->curr_count--;
                                         bye = 1;
-                                        gf_log (conf->this->name, GF_LOG_DEBUG,
-                                                "timeout, terminated. conf->curr_count=%d",
-                                                conf->curr_count);
+                                        gf_msg_debug (conf->this->name, 0,
+                                                      "timeout, terminated. conf->curr_count=%d",
+                                                      conf->curr_count);
                                 } else {
                                         timeout = 0;
                                 }
@@ -346,8 +347,8 @@ iot_schedule (call_frame_t *frame, xlator_t *this, call_stub_t *stub)
                 return -EINVAL;
         }
 out:
-        gf_log (this->name, GF_LOG_DEBUG, "%s scheduled as %s fop",
-                gf_fop_list[stub->fop], iot_get_pri_meaning (pri));
+        gf_msg_debug (this->name, 0, "%s scheduled as %s fop",
+                      gf_fop_list[stub->fop], iot_get_pri_meaning (pri));
         ret = do_iot_schedule (this->private, stub, pri);
         return ret;
 }
@@ -768,9 +769,10 @@ __iot_workers_scale (iot_conf_t *conf)
                 ret = gf_thread_create (&thread, &conf->w_attr, iot_worker, conf);
                 if (ret == 0) {
                         conf->curr_count++;
-                        gf_log (conf->this->name, GF_LOG_DEBUG,
-                                "scaled threads to %d (queue_size=%d/%d)",
-                                conf->curr_count, conf->queue_size, scale);
+                        gf_msg_debug (conf->this->name, 0,
+                                      "scaled threads to %d (queue_size=%d/%d)",
+                                      conf->curr_count,
+                                      conf->queue_size, scale);
                 } else {
                         break;
                 }
@@ -815,11 +817,13 @@ set_stack_size (iot_conf_t *conf)
         if (err == EINVAL) {
                 err = pthread_attr_getstacksize (&conf->w_attr, &stacksize);
                 if (!err)
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING,
+                                0, IO_THREADS_MSG_SIZE_NOT_SET,
                                 "Using default thread stack size %zd",
                                 stacksize);
                 else
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING,
+                                0, IO_THREADS_MSG_SIZE_NOT_SET,
                                 "Using default thread stack size");
         }
 
@@ -838,8 +842,9 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_iot_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
-                                "failed");
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, IO_THREADS_MSG_NO_MEMORY,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -930,32 +935,37 @@ init (xlator_t *this)
         int         i    = 0;
 
 	if (!this->children || this->children->next) {
-		gf_log ("io-threads", GF_LOG_ERROR,
-			"FATAL: iot not configured with exactly one child");
+		gf_msg ("io-threads", GF_LOG_ERROR, 0,
+                        IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED,
+			"FATAL: iot not configured "
+                        "with exactly one child");
                 goto out;
 	}
 
 	if (!this->parents) {
-		gf_log (this->name, GF_LOG_WARNING,
-			"dangling volume. check volfile ");
+		gf_msg (this->name, GF_LOG_WARNING, 0,
+			IO_THREADS_MSG_VOL_MISCONFIGURED,
+                        "dangling volume. check volfile ");
 	}
 
 	conf = (void *) GF_CALLOC (1, sizeof (*conf),
                                    gf_iot_mt_iot_conf_t);
         if (conf == NULL) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "out of memory");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        IO_THREADS_MSG_NO_MEMORY, "out of memory");
                 goto out;
         }
 
         if ((ret = pthread_cond_init(&conf->cond, NULL)) != 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_THREADS_MSG_INIT_FAILED,
                         "pthread_cond_init failed (%d)", ret);
                 goto out;
         }
 
         if ((ret = pthread_mutex_init(&conf->mutex, NULL)) != 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_THREADS_MSG_INIT_FAILED,
                         "pthread_mutex_init failed (%d)", ret);
                 goto out;
         }
@@ -983,7 +993,8 @@ init (xlator_t *this)
 	GF_OPTION_INIT("least-rate-limit", conf->throttle.rate_limit, int32,
 		       out);
         if ((ret = pthread_mutex_init(&conf->throttle.lock, NULL)) != 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_THREADS_MSG_INIT_FAILED,
                         "pthread_mutex_init failed (%d)", ret);
                 goto out;
         }
@@ -997,7 +1008,8 @@ init (xlator_t *this)
 	ret = iot_workers_scale (conf);
 
         if (ret == -1) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        IO_THREADS_MSG_INIT_FAILED,
                         "cannot initialize worker threads, exiting init");
                 goto out;
         }
diff --git a/xlators/performance/md-cache/src/md-cache-messages.h b/xlators/performance/md-cache/src/md-cache-messages.h
new file mode 100644
index 0000000..2fe8d45
--- /dev/null
+++ b/xlators/performance/md-cache/src/md-cache-messages.h
@@ -0,0 +1,66 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _MD_CACHE_MESSAGES_H_
+#define _MD_CACHE_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file md-cache-messages.h
+ *  \brief MD_CACHE log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_MD_CACHE_BASE                   GLFS_MSGID_COMP_MD_CACHE
+#define GLFS_MD_CACHE_NUM_MESSAGES           1
+#define GLFS_MSGID_END  (GLFS_MD_CACHE_BASE + GLFS_MD_CACHE_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_MD_CACHE_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define MD_CACHE_MSG_NO_MEMORY        (GLFS_MD_CACHE_BASE + 1)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _MD_CACHE_MESSAGES_H_ */
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index 51c0733..c3b4dfe 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -22,6 +22,7 @@
 #include "glusterfs-acl.h"
 #include <assert.h>
 #include <sys/time.h>
+#include "md-cache-messages.h"
 
 
 /* TODO:
@@ -292,8 +293,8 @@ mdc_inode_prep (xlator_t *this, inode_t *inode)
 
                 mdc = GF_CALLOC (sizeof (*mdc), 1, gf_mdc_mt_md_cache_t);
                 if (!mdc) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "out of memory :(");
+                        gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                                MD_CACHE_MSG_NO_MEMORY, "out of memory");
                         goto unlock;
                 }
 
@@ -301,8 +302,8 @@ mdc_inode_prep (xlator_t *this, inode_t *inode)
 
                 ret = __mdc_inode_ctx_set (this, inode, mdc);
                 if (ret) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "out of memory :(");
+                        gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                                MD_CACHE_MSG_NO_MEMORY, "out of memory");
                         GF_FREE (mdc);
                         mdc = NULL;
                 }
@@ -2247,8 +2248,8 @@ init (xlator_t *this)
 
 	conf = GF_CALLOC (sizeof (*conf), 1, gf_mdc_mt_mdc_conf_t);
 	if (!conf) {
-		gf_log (this->name, GF_LOG_ERROR,
-			"out of memory");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        MD_CACHE_MSG_NO_MEMORY, "out of memory");
 		return -1;
 	}
 
diff --git a/xlators/performance/open-behind/src/open-behind-messages.h b/xlators/performance/open-behind/src/open-behind-messages.h
new file mode 100644
index 0000000..57e63ea
--- /dev/null
+++ b/xlators/performance/open-behind/src/open-behind-messages.h
@@ -0,0 +1,85 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _OPEN_BEHIND_MESSAGES_H_
+#define _OPEN_BEHIND_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file open-behind-messages.h
+ *  \brief OPEN_BEHIND log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_OPEN_BEHIND_BASE                   GLFS_MSGID_COMP_OPEN_BEHIND
+#define GLFS_OPEN_BEHIND_NUM_MESSAGES           3
+#define GLFS_MSGID_END  (GLFS_OPEN_BEHIND_BASE + \
+        GLFS_OPEN_BEHIND_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_OPEN_BEHIND_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED (GLFS_OPEN_BEHIND_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define OPEN_BEHIND_MSG_VOL_MISCONFIGURED        (GLFS_OPEN_BEHIND_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define OPEN_BEHIND_MSG_NO_MEMORY        (GLFS_OPEN_BEHIND_BASE + 3)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _OPEN_BEHIND_MESSAGES_H_ */
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
index 742e4df..97c12fa 100644
--- a/xlators/performance/open-behind/src/open-behind.c
+++ b/xlators/performance/open-behind/src/open-behind.c
@@ -13,6 +13,7 @@
 #include "statedump.h"
 #include "call-stub.h"
 #include "defaults.h"
+#include "open-behind-messages.h"
 
 typedef struct ob_conf {
 	gf_boolean_t  use_anonymous_fd; /* use anonymous FDs wherever safe
@@ -340,8 +341,8 @@ ob_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
 
 	return 0;
 err:
-	gf_log (this->name, GF_LOG_ERROR, "%s: %s", loc->path,
-		strerror (op_errno));
+	gf_msg (this->name, GF_LOG_ERROR, op_errno, OPEN_BEHIND_MSG_NO_MEMORY,
+                "%s", loc->path);
 
 	STACK_UNWIND_STRICT (open, frame, -1, op_errno, 0, 0);
 
@@ -887,7 +888,9 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_ob_mt_end + 1);
 
         if (ret)
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting failed");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        OPEN_BEHIND_MSG_NO_MEMORY,
+                        "Memory accounting failed");
 
         return ret;
 }
@@ -920,14 +923,16 @@ init (xlator_t *this)
         ob_conf_t    *conf = NULL;
 
         if (!this->children || this->children->next) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: volume (%s) not configured with exactly one "
                         "child", this->name);
                 return -1;
         }
 
         if (!this->parents)
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        OPEN_BEHIND_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfile ");
 
         conf = GF_CALLOC (1, sizeof (*conf), gf_ob_mt_conf_t);
diff --git a/xlators/performance/quick-read/src/quick-read-messages.h b/xlators/performance/quick-read/src/quick-read-messages.h
new file mode 100644
index 0000000..d7444dd
--- /dev/null
+++ b/xlators/performance/quick-read/src/quick-read-messages.h
@@ -0,0 +1,119 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _QUICK_READ_MESSAGES_H_
+#define _QUICK_READ_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file quick-read-messages.h
+ *  \brief QUICK_READ log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_QUICK_READ_BASE                    GLFS_MSGID_COMP_QUICK_READ
+#define GLFS_QUICK_READ_NUM_MESSAGES            7
+#define GLFS_MSGID_END                          (GLFS_QUICK_READ_BASE +\
+                                              GLFS_QUICK_READ_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_QUICK_READ_BASE, "Invalid: Start of messages"
+
+
+#define QUICK_READ_MSG_ENFORCEMENT_FAILED       (GLFS_QUICK_READ_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_INVALID_ARGUMENT         (GLFS_QUICK_READ_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED\
+                                                (GLFS_QUICK_READ_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_NO_MEMORY                (GLFS_QUICK_READ_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_VOL_MISCONFIGURED        (GLFS_QUICK_READ_BASE + 5)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_DICT_SET_FAILED          (GLFS_QUICK_READ_BASE + 6)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define QUICK_READ_MSG_INVALID_CONFIG           (GLFS_QUICK_READ_BASE + 7)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _QUICK_READ_MESSAGES_H_ */
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 53f9a5d..c6913ee 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -10,6 +10,7 @@
 
 #include "quick-read.h"
 #include "statedump.h"
+#include "quick-read-messages.h"
 
 qr_inode_t *qr_inode_ctx_get (xlator_t *this, inode_t *inode);
 void __qr_inode_prune (qr_inode_table_t *table, qr_inode_t *qr_inode);
@@ -471,8 +472,9 @@ qr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
 		ret = dict_set (xdata, GF_CONTENT_KEY,
 				data_from_uint64 (conf->max_file_size));
 	if (ret)
-		gf_log (this->name, GF_LOG_WARNING,
-			"cannot set key in request dict (%s)",
+		gf_msg (this->name, GF_LOG_WARNING, 0,
+			QUICK_READ_MSG_DICT_SET_FAILED,
+                        "cannot set key in request dict (%s)",
 			loc->path);
 wind:
 	frame->local = inode_ref (loc->inode);
@@ -784,8 +786,9 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_qr_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
-                        "failed");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        QUICK_READ_MSG_NO_MEMORY,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -805,7 +808,8 @@ check_cache_size_ok (xlator_t *this, int64_t cache_size)
         opt = xlator_volume_option_get (this, "cache-size");
         if (!opt) {
                 ret = _gf_false;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        QUICK_READ_MSG_INVALID_ARGUMENT,
                         "could not get cache-size option");
                 goto out;
         }
@@ -816,11 +820,12 @@ check_cache_size_ok (xlator_t *this, int64_t cache_size)
         else
                 max_cache_size = total_mem;
 
-        gf_log (this->name, GF_LOG_DEBUG, "Max cache size is %"PRIu64,
-                max_cache_size);
+        gf_msg_debug (this->name, 0, "Max cache size is %"PRIu64,
+                      max_cache_size);
         if (cache_size > max_cache_size) {
                 ret = _gf_false;
-                gf_log (this->name, GF_LOG_ERROR, "Cache size %"PRIu64
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        QUICK_READ_MSG_INVALID_ARGUMENT, "Cache size %"PRIu64
                         " is greater than the max size of %"PRIu64,
                         cache_size, max_cache_size);
                 goto out;
@@ -854,7 +859,8 @@ reconfigure (xlator_t *this, dict_t *options)
         GF_OPTION_RECONF ("cache-size", cache_size_new, options, size_uint64, out);
         if (!check_cache_size_ok (this, cache_size_new)) {
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        QUICK_READ_MSG_INVALID_CONFIG,
                         "Not reconfiguring cache-size");
                 goto out;
         }
@@ -923,10 +929,9 @@ qr_get_priority_list (const char *opt_str, struct list_head *first)
                         goto out;
                 }
 
-                gf_log ("quick-read", GF_LOG_TRACE,
-                        "quick-read priority : pattern %s : priority %s",
-                        pattern,
-                        priority);
+                gf_msg_trace ("quick-read", 0,
+                              "quick-read priority : pattern %s : priority %s",
+                              pattern, priority);
 
                 curr->pattern = gf_strdup (pattern);
                 if (curr->pattern == NULL) {
@@ -972,14 +977,16 @@ init (xlator_t *this)
         qr_conf_t    *conf = NULL;
 
         if (!this->children || this->children->next) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: volume (%s) not configured with exactly one "
                         "child", this->name);
                 return -1;
         }
 
         if (!this->parents) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        QUICK_READ_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfile ");
         }
 
@@ -1007,8 +1014,8 @@ init (xlator_t *this)
         if (dict_get (this->options, "priority")) {
                 char *option_list = data_to_str (dict_get (this->options,
                                                            "priority"));
-                gf_log (this->name, GF_LOG_TRACE,
-                        "option path %s", option_list);
+                gf_msg_trace (this->name, 0,
+                              "option path %s", option_list);
                 /* parse the list of pattern:priority */
                 conf->max_pri = qr_get_priority_list (option_list,
                                                       &conf->priority_list);
diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c
index 6e5b52c..f96a23c 100644
--- a/xlators/performance/read-ahead/src/page.c
+++ b/xlators/performance/read-ahead/src/page.c
@@ -19,6 +19,7 @@
 #include "xlator.h"
 #include "read-ahead.h"
 #include <assert.h>
+#include "read-ahead-messages.h"
 
 ra_page_t *
 ra_page_get (ra_file_t *file, off_t offset)
@@ -155,7 +156,8 @@ ra_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
         pending_offset = local->pending_offset;
 
         if (file == NULL) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, EBADF,
+                        READ_AHEAD_MSG_FD_CONTEXT_NOT_SET,
                         "read-ahead context not set in fd (%p)", fd);
                 op_ret = -1;
                 op_errno = EBADF;
@@ -170,9 +172,10 @@ ra_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
                 page = ra_page_get (file, pending_offset);
 
                 if (!page) {
-                        gf_log (this->name, GF_LOG_TRACE,
-                                "wasted copy: %"PRId64"[+%"PRId64"] file=%p",
-                                pending_offset, file->page_size, file);
+                        gf_msg_trace (this->name, 0,
+                                      "wasted copy: "
+                                      "%"PRId64"[+%"PRId64"] file=%p",
+                                      pending_offset, file->page_size, file);
                         goto unlock;
                 }
 
diff --git a/xlators/performance/read-ahead/src/read-ahead-messages.h b/xlators/performance/read-ahead/src/read-ahead-messages.h
new file mode 100644
index 0000000..a205cee
--- /dev/null
+++ b/xlators/performance/read-ahead/src/read-ahead-messages.h
@@ -0,0 +1,94 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _READ_AHEAD_MESSAGES_H_
+#define _READ_AHEAD_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file read-ahead-messages.h
+ *  \brief READ_AHEAD log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_READ_AHEAD_BASE                   GLFS_MSGID_COMP_READ_AHEAD
+#define GLFS_READ_AHEAD_NUM_MESSAGES           4
+#define GLFS_MSGID_END  (GLFS_READ_AHEAD_BASE +\
+         GLFS_READ_AHEAD_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_READ_AHEAD_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED   (GLFS_READ_AHEAD_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READ_AHEAD_MSG_VOL_MISCONFIGURED        (GLFS_READ_AHEAD_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READ_AHEAD_MSG_NO_MEMORY        (GLFS_READ_AHEAD_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READ_AHEAD_MSG_FD_CONTEXT_NOT_SET        (GLFS_READ_AHEAD_BASE + 4)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _READ_AHEAD_MESSAGES_H_ */
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index 7ea9f40..f33263c 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -28,6 +28,7 @@
 #include "statedump.h"
 #include <assert.h>
 #include <sys/time.h>
+#include "read-ahead-messages.h"
 
 static void
 read_ahead (call_frame_t *frame, ra_file_t *file);
@@ -89,8 +90,10 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
 
         ret = fd_ctx_set (fd, this, (uint64_t)(long)file);
         if (ret == -1) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "cannot set read-ahead context information in fd (%p)",
+                gf_msg (frame->this->name, GF_LOG_WARNING,
+                        0, READ_AHEAD_MSG_NO_MEMORY,
+                        "cannot set read-ahead context"
+                        "information in fd (%p)",
                         fd);
                 ra_file_destroy (file);
                 op_ret = -1;
@@ -161,8 +164,10 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
 
         ret = fd_ctx_set (fd, this, (uint64_t)(long)file);
         if (ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "cannot set read ahead context information in fd (%p)",
+                gf_msg (this->name, GF_LOG_WARNING,
+                        0, READ_AHEAD_MSG_NO_MEMORY,
+                        "cannot set read ahead context"
+                        "information in fd (%p)",
                         fd);
                 ra_file_destroy (file);
                 op_ret = -1;
@@ -329,8 +334,8 @@ read_ahead (call_frame_t *frame, ra_file_t *file)
                 }
 
                 if (fault) {
-                        gf_log (frame->this->name, GF_LOG_TRACE,
-                                "RA at offset=%"PRId64, trav_offset);
+                        gf_msg_trace (frame->this->name, 0,
+                                      "RA at offset=%"PRId64, trav_offset);
                         ra_page_fault (file, frame, trav_offset);
                 }
                 trav_offset += file->page_size;
@@ -396,14 +401,15 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
                         trav->dirty = 0;
 
                         if (trav->ready) {
-                                gf_log (frame->this->name, GF_LOG_TRACE,
-                                        "HIT at offset=%"PRId64".",
-                                        trav_offset);
+                                gf_msg_trace (frame->this->name, 0,
+                                              "HIT at offset=%"PRId64".",
+                                              trav_offset);
                                 ra_frame_fill (trav, frame);
                         } else {
-                                gf_log (frame->this->name, GF_LOG_TRACE,
-                                        "IN-TRANSIT at offset=%"PRId64".",
-                                        trav_offset);
+                                gf_msg_trace (frame->this->name, 0,
+                                              "IN-TRANSIT at "
+                                              "offset=%"PRId64".",
+                                              trav_offset);
                                 ra_wait_on_page (trav, frame);
                                 need_atime_update = 0;
                         }
@@ -416,9 +422,9 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
                 }
 
                 if (fault) {
-                        gf_log (frame->this->name, GF_LOG_TRACE,
-                                "MISS at offset=%"PRId64".",
-                                trav_offset);
+                        gf_msg_trace (frame->this->name, 0,
+                                      "MISS at offset=%"PRId64".",
+                                      trav_offset);
                         ra_page_fault (file, frame, trav_offset);
                 }
 
@@ -476,9 +482,9 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
 
         conf = this->private;
 
-        gf_log (this->name, GF_LOG_TRACE,
-                "NEW REQ at offset=%"PRId64" for size=%"GF_PRI_SIZET"",
-                offset, size);
+        gf_msg_trace (this->name, 0,
+                      "NEW REQ at offset=%"PRId64" for size=%"GF_PRI_SIZET"",
+                      offset, size);
 
         fd_ctx_get (fd, this, &tmp_file);
         file = (ra_file_t *)(long)tmp_file;
@@ -488,15 +494,16 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
         }
 
         if (file->offset != offset) {
-                gf_log (this->name, GF_LOG_TRACE,
-                        "unexpected offset (%"PRId64" != %"PRId64") resetting",
-                        file->offset, offset);
+                gf_msg_trace (this->name, 0,
+                              "unexpected offset (%"PRId64" != %"PRId64") "
+                              "resetting",
+                              file->offset, offset);
 
                 expected_offset = file->expected = file->page_count = 0;
         } else {
-                gf_log (this->name, GF_LOG_TRACE,
-                        "expected offset (%"PRId64") when page_count=%d",
-                        offset, file->page_count);
+                gf_msg_trace (this->name, 0,
+                              "expected offset (%"PRId64") when page_count=%d",
+                              offset, file->page_count);
 
                 if (file->expected < (file->page_size * conf->page_count)) {
                         file->expected += size;
@@ -1103,7 +1110,8 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_ra_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        READ_AHEAD_MSG_NO_MEMORY, "Memory accounting init"
                         "failed");
         }
 
@@ -1141,14 +1149,16 @@ init (xlator_t *this)
         GF_VALIDATE_OR_GOTO ("read-ahead", this, out);
 
         if (!this->children || this->children->next) {
-                gf_log (this->name,  GF_LOG_ERROR,
+                gf_msg (this->name,  GF_LOG_ERROR, 0,
+                        READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: read-ahead not configured with exactly one"
                         " child");
                 goto out;
         }
 
         if (!this->parents) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        READ_AHEAD_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfile ");
         }
 
@@ -1173,7 +1183,8 @@ init (xlator_t *this)
         this->local_pool = mem_pool_new (ra_local_t, 64);
         if (!this->local_pool) {
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR,
+                        ENOMEM, READ_AHEAD_MSG_NO_MEMORY,
                         "failed to create local_t's memory pool");
                 goto out;
         }
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
new file mode 100644
index 0000000..0e19348
--- /dev/null
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
@@ -0,0 +1,105 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _READDIR_AHEAD_MESSAGES_H_
+#define _READDIR_AHEAD_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file readdir-ahead-messages.h
+ *  \brief READDIR_AHEAD log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_READDIR_AHEAD_BASE                   GLFS_MSGID_COMP_READDIR_AHEAD
+#define GLFS_READDIR_AHEAD_NUM_MESSAGES           5
+#define GLFS_MSGID_END          (GLFS_READDIR_AHEAD_BASE +\
+        GLFS_READDIR_AHEAD_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_READDIR_AHEAD_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED\
+        (GLFS_READDIR_AHEAD_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READDIR_AHEAD_MSG_VOL_MISCONFIGURED        (GLFS_READDIR_AHEAD_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READDIR_AHEAD_MSG_NO_MEMORY        (GLFS_READDIR_AHEAD_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB \
+        (GLFS_READDIR_AHEAD_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define READDIR_AHEAD_MSG_OUT_OF_SEQUENCE        (GLFS_READDIR_AHEAD_BASE + 5)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _READDIR_AHEAD_MESSAGES_H_ */
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
index 1a567a0..75f30d9 100644
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
@@ -34,7 +34,7 @@
 #include "readdir-ahead.h"
 #include "readdir-ahead-mem-types.h"
 #include "defaults.h"
-
+#include "readdir-ahead-messages.h"
 static int rda_fill_fd(call_frame_t *, xlator_t *, fd_t *);
 
 /*
@@ -262,8 +262,9 @@ rda_fill_fd_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
 
 	/* Verify that the preload buffer is still pending on this data. */
 	if (ctx->next_offset != local->offset) {
-		gf_log(this->name, GF_LOG_ERROR,
-			"Out of sequence directory preload.");
+		gf_msg(this->name, GF_LOG_ERROR,
+                       0, READDIR_AHEAD_MSG_OUT_OF_SEQUENCE,
+                       "Out of sequence directory preload.");
 		ctx->state |= (RDA_FD_BYPASS|RDA_FD_ERROR);
 		ctx->op_errno = EUCLEAN;
 
@@ -434,8 +435,9 @@ rda_releasedir(xlator_t *this, fd_t *fd)
 		STACK_DESTROY(ctx->fill_frame->root);
 
 	if (ctx->stub)
-		gf_log(this->name, GF_LOG_ERROR,
-			"released a directory with a pending stub");
+		gf_msg(this->name, GF_LOG_ERROR, 0,
+		        READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB,
+                       "released a directory with a pending stub");
 
 	GF_FREE(ctx);
 	return 0;
@@ -452,7 +454,8 @@ mem_acct_init(xlator_t *this)
 	ret = xlator_mem_acct_init(this, gf_rda_mt_end + 1);
 
 	if (ret != 0)
-		gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
+		gf_msg(this->name, GF_LOG_ERROR, ENOMEM,
+                       READDIR_AHEAD_MSG_NO_MEMORY, "Memory accounting init"
 		       "failed");
 
 out:
@@ -484,14 +487,16 @@ init(xlator_t *this)
         GF_VALIDATE_OR_GOTO("readdir-ahead", this, err);
 
         if (!this->children || this->children->next) {
-                gf_log(this->name,  GF_LOG_ERROR,
+                gf_msg(this->name,  GF_LOG_ERROR, 0,
+                        READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: readdir-ahead not configured with exactly one"
                         " child");
                 goto err;
         }
 
         if (!this->parents) {
-                gf_log(this->name, GF_LOG_WARNING,
+                gf_msg(this->name, GF_LOG_WARNING, 0,
+                        READDIR_AHEAD_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfile ");
         }
 
diff --git a/xlators/performance/symlink-cache/src/symlink-cache-messages.h b/xlators/performance/symlink-cache/src/symlink-cache-messages.h
new file mode 100644
index 0000000..89ea118
--- /dev/null
+++ b/xlators/performance/symlink-cache/src/symlink-cache-messages.h
@@ -0,0 +1,93 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _SYMLINK_CACHE_MESSAGES_H_
+#define _SYMLINK_CACHE_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file symlink_cache-messages.h
+ *  \brief SYMLINK_CACHE log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_SYMLINK_CACHE_BASE                 GLFS_MSGID_COMP_SYMLINK_CACHE
+#define GLFS_SYMLINK_CACHE_NUM_MESSAGES         5
+#define GLFS_MSGID_END                  (GLFS_SYMLINK_CACHE_BASE +\
+                                        GLFS_SYMLINK_CACHE_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_SYMLINK_CACHE_BASE, "Invalid: Start of messages"
+
+#define SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED\
+        (GLFS_SYMLINK_CACHE_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define SYMLINK_CACHE_MSG_VOL_MISCONFIGURED     (GLFS_SYMLINK_CACHE_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define SYMLINK_CACHE_MSG_NO_MEMORY             (GLFS_SYMLINK_CACHE_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define SYMLINK_CACHE_MSG_DICT_GET_FAILED       (GLFS_SYMLINK_CACHE_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define SYMLINK_CACHE_MSG_DICT_SET_FAILED       (GLFS_SYMLINK_CACHE_BASE + 5)
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _SYMLINK_CACHE_MESSAGES_H_ */
diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c
index c65629b..6ecfad4 100644
--- a/xlators/performance/symlink-cache/src/symlink-cache.c
+++ b/xlators/performance/symlink-cache/src/symlink-cache.c
@@ -22,6 +22,7 @@
 #include "compat.h"
 #include "compat-errno.h"
 #include "common-utils.h"
+#include "symlink-cache-messages.h"
 
 struct symlink_cache {
 	time_t ctime;
@@ -36,7 +37,8 @@ symlink_inode_ctx_get (inode_t *inode, xlator_t *this, void **ctx)
 	uint64_t tmp_ctx = 0;
 	ret = inode_ctx_get (inode, this, &tmp_ctx);
 	if (-1 == ret)
-		gf_log (this->name, GF_LOG_ERROR, "dict get failed");
+		gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        SYMLINK_CACHE_MSG_DICT_GET_FAILED, "dict get failed");
 	else
 		*ctx = (void *)(long)tmp_ctx;
 
@@ -50,7 +52,8 @@ symlink_inode_ctx_set (inode_t *inode, xlator_t *this, void *ctx)
 	int ret = 0;
 	ret = inode_ctx_put (inode, this, (uint64_t)(long) ctx);
 	if (-1 == ret)
-		gf_log (this->name, GF_LOG_ERROR, "dict set failed");
+		gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        SYMLINK_CACHE_MSG_DICT_SET_FAILED, "dict set failed");
 
 	return 0;
 }
@@ -66,15 +69,15 @@ sc_cache_update (xlator_t *this, inode_t *inode, const char *link)
 		return 0;
 
 	if (!sc->readlink) {
-		gf_log (this->name, GF_LOG_DEBUG,
-			"updating cache: %s", link);
+		gf_msg_debug (this->name, 0,
+                              "updating cache: %s", link);
 
 		sc->readlink = strdup (link);
-	} else {
-		gf_log (this->name, GF_LOG_DEBUG,
-			"not updating existing cache: %s with %s",
-			sc->readlink, link);
-	}
+	} else
+                gf_msg_debug (this->name, 0,
+                              "not updating existing cache: %s with %s",
+                              sc->readlink, link);
+
 
 	return 0;
 }
@@ -94,16 +97,17 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
 		need_set = 1;
 		sc = CALLOC (1, sizeof (*sc));
 		if (!sc) {
-			gf_log (this->name, GF_LOG_ERROR,
-				"out of memory :(");
+			gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+				SYMLINK_CACHE_MSG_NO_MEMORY,
+                                "out of memory :(");
 			goto err;
 		}
 	}
 
 	if (sc->readlink) {
-		gf_log (this->name, GF_LOG_DEBUG,
-			"replacing old cache: %s with new cache: %s",
-			sc->readlink, link);
+		gf_msg_debug (this->name, 0,
+                              "replacing old cache: %s with new cache: %s",
+                              sc->readlink, link);
 		FREE (sc->readlink);
 		sc->readlink = NULL;
 	}
@@ -111,24 +115,25 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
 	if (link) {
 		sc->readlink = strdup (link);
 		if (!sc->readlink) {
-			gf_log (this->name, GF_LOG_ERROR,
-				"out of memory :(");
+			gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+				SYMLINK_CACHE_MSG_NO_MEMORY,
+                                "out of memory :(");
 			goto err;
 		}
 	}
 
 	sc->ctime = buf->ia_ctime;
 
-	gf_log (this->name, GF_LOG_DEBUG,
-		"setting symlink cache: %s", link);
+	gf_msg_debug (this->name, 0,
+                      "setting symlink cache: %s", link);
 
 	if (need_set) {
 		ret = symlink_inode_ctx_set (inode, this, sc);
 
 		if (ret < 0) {
-			gf_log (this->name, GF_LOG_ERROR,
-				"could not set inode context (%s)",
-				strerror (-ret));
+			gf_msg (this->name, GF_LOG_ERROR,
+                                -ret, SYMLINK_CACHE_MSG_NO_MEMORY,
+                                "could not set inode context ");
 			goto err;
 		}
 	}
@@ -156,8 +161,8 @@ sc_cache_flush (xlator_t *this, inode_t *inode)
 		return 0;
 
 	if (sc->readlink) {
-		gf_log (this->name, GF_LOG_DEBUG,
-			"flushing cache: %s", sc->readlink);
+		gf_msg_debug (this->name, 0,
+                              "flushing cache: %s", sc->readlink);
 
 		FREE (sc->readlink);
 		sc->readlink = NULL;
@@ -199,8 +204,8 @@ sc_cache_validate (xlator_t *this, inode_t *inode, struct iatt *buf)
 
 	/* STALE */
 	if (sc->readlink) {
-		gf_log (this->name, GF_LOG_DEBUG,
-			"flushing cache: %s", sc->readlink);
+		gf_msg_debug (this->name, 0,
+                              "flushing cache: %s", sc->readlink);
 
 		FREE (sc->readlink);
 		sc->readlink = NULL;
@@ -257,9 +262,9 @@ sc_readlink (call_frame_t *frame, xlator_t *this,
 
 	if (link) {
 		/* cache hit */
-		gf_log (this->name, GF_LOG_DEBUG,
-			"cache hit %s -> %s",
-			loc->path, link);
+		gf_msg_debug (this->name, 0,
+                              "cache hit %s -> %s",
+                              loc->path, link);
 
                 /*
                   libglusterfsclient, nfs or any other translators
@@ -361,15 +366,17 @@ init (xlator_t *this)
 {
         if (!this->children || this->children->next)
         {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED,
                         "FATAL: volume (%s) not configured with exactly one "
 			"child", this->name);
                 return -1;
         }
 
 	if (!this->parents) {
-		gf_log (this->name, GF_LOG_WARNING,
-			"dangling volume. check volfile ");
+		gf_msg (this->name, GF_LOG_WARNING, 0,
+			SYMLINK_CACHE_MSG_VOL_MISCONFIGURED,
+                        "dangling volume. check volfile ");
 	}
 
         return 0;
diff --git a/xlators/performance/write-behind/src/write-behind-messages.h b/xlators/performance/write-behind/src/write-behind-messages.h
new file mode 100644
index 0000000..d0934cf
--- /dev/null
+++ b/xlators/performance/write-behind/src/write-behind-messages.h
@@ -0,0 +1,121 @@
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _WRITE_BEHIND_MESSAGES_H_
+#define _WRITE_BEHIND_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/*! \file write-behind-messages.h
+ *  \brief WRITE_BEHIND log-message IDs and their descriptions
+ *
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_WRITE_BEHIND_BASE                   GLFS_MSGID_COMP_WRITE_BEHIND
+#define GLFS_WRITE_BEHIND_NUM_MESSAGES           7
+#define GLFS_MSGID_END  (GLFS_WRITE_BEHIND_BASE +\
+        GLFS_WRITE_BEHIND_NUM_MESSAGES + 1)
+
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_WRITE_BEHIND_BASE, "Invalid: Start of messages"
+
+
+
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE        (GLFS_WRITE_BEHIND_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_INIT_FAILED        (GLFS_WRITE_BEHIND_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_INVALID_ARGUMENT        (GLFS_WRITE_BEHIND_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_NO_MEMORY        (GLFS_WRITE_BEHIND_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_SIZE_NOT_SET        (GLFS_WRITE_BEHIND_BASE + 5)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_VOL_MISCONFIGURED        (GLFS_WRITE_BEHIND_BASE + 6)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction  None
+ *
+ */
+
+#define WRITE_BEHIND_MSG_RES_UNAVAILABLE        (GLFS_WRITE_BEHIND_BASE + 7)
+
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+
+#endif /* _WRITE_BEHIND_MESSAGES_H_ */
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 3cb0d44..84e444d 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -26,6 +26,7 @@
 #include "statedump.h"
 #include "defaults.h"
 #include "write-behind-mem-types.h"
+#include "write-behind-messages.h"
 
 #define MAX_VECTOR_COUNT          8
 #define WB_AGGREGATE_SIZE         131072 /* 128 KB */
@@ -356,7 +357,8 @@ __wb_request_unref (wb_request_t *req)
 	wb_inode = req->wb_inode;
 
         if (req->refcount <= 0) {
-                gf_log ("wb-request", GF_LOG_WARNING,
+                gf_msg ("wb-request", GF_LOG_WARNING,
+                        0, WRITE_BEHIND_MSG_RES_UNAVAILABLE,
                         "refcount(%d) is <= 0", req->refcount);
                 goto out;
         }
@@ -422,7 +424,8 @@ __wb_request_ref (wb_request_t *req)
         GF_VALIDATE_OR_GOTO ("write-behind", req, out);
 
         if (req->refcount < 0) {
-                gf_log ("wb-request", GF_LOG_WARNING,
+                gf_msg ("wb-request", GF_LOG_WARNING, 0,
+                        WRITE_BEHIND_MSG_RES_UNAVAILABLE,
                         "refcount(%d) is < 0", req->refcount);
                 req = NULL;
                 goto out;
@@ -993,7 +996,8 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req)
 
                 ret = iobref_add (iobref, iobuf);
                 if (ret != 0) {
-                        gf_log (req->wb_inode->this->name, GF_LOG_WARNING,
+                        gf_msg (req->wb_inode->this->name, GF_LOG_WARNING,
+                                -ret, WRITE_BEHIND_MSG_INVALID_ARGUMENT,
                                 "cannot add iobuf (%p) into iobref (%p)",
                                 iobuf, iobref);
                         iobuf_unref (iobuf);
@@ -2099,7 +2103,9 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_wb_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                        WRITE_BEHIND_MSG_NO_MEMORY,
+                        "Memory accounting init"
                         "failed");
         }
 
@@ -2143,14 +2149,16 @@ init (xlator_t *this)
 
         if ((this->children == NULL)
             || this->children->next) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        WRITE_BEHIND_MSG_INIT_FAILED,
                         "FATAL: write-behind (%s) not configured with exactly "
                         "one child", this->name);
                 goto out;
         }
 
         if (this->parents == NULL) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        WRITE_BEHIND_MSG_VOL_MISCONFIGURED,
                         "dangling volume. check volfilex");
         }
 
@@ -2166,7 +2174,8 @@ init (xlator_t *this)
         GF_OPTION_INIT ("cache-size", conf->window_size, size_uint64, out);
 
         if (!conf->window_size && conf->aggregate_size) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        WRITE_BEHIND_MSG_SIZE_NOT_SET,
                         "setting window-size to be equal to "
                         "aggregate-size(%"PRIu64")",
                         conf->aggregate_size);
@@ -2174,7 +2183,8 @@ init (xlator_t *this)
         }
 
         if (conf->window_size < conf->aggregate_size) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE,
                         "aggregate-size(%"PRIu64") cannot be more than "
                         "window-size(%"PRIu64")", conf->aggregate_size,
                         conf->window_size);
-- 
1.7.1