7f4c2a
From 721e99e499ae3b2ac1903282eeef6fdd2676678d Mon Sep 17 00:00:00 2001
7f4c2a
From: Mohamed Ashiq <ashiq333@gmail.com>
7f4c2a
Date: Fri, 17 Apr 2015 17:33:49 +0530
7f4c2a
Subject: [PATCH 157/190] bit-rot : New logging framework for bit-rot log message
7f4c2a
7f4c2a
    Backport of http://review.gluster.org/10297
7f4c2a
7f4c2a
Change-Id: I83c494f2bb60d29495cd643659774d430325af0a
7f4c2a
BUG: 1231796
7f4c2a
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/51559
7f4c2a
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
7f4c2a
Tested-by: Raghavendra Bhat <raghavendra@redhat.com>
7f4c2a
---
7f4c2a
 libglusterfs/src/glfs-message-id.h                 |   12 +-
7f4c2a
 xlators/features/bit-rot/src/bitd/Makefile.am      |    2 +-
7f4c2a
 .../bit-rot/src/bitd/bit-rot-bitd-messages.h       |  391 ++++++++++++++++++++
7f4c2a
 xlators/features/bit-rot/src/bitd/bit-rot-scrub.c  |  101 +++---
7f4c2a
 xlators/features/bit-rot/src/bitd/bit-rot.c        |  239 +++++++-----
7f4c2a
 xlators/features/bit-rot/src/stub/Makefile.am      |    2 +-
7f4c2a
 .../bit-rot/src/stub/bit-rot-stub-messages.h       |  158 ++++++++
7f4c2a
 xlators/features/bit-rot/src/stub/bit-rot-stub.c   |  116 ++++---
7f4c2a
 xlators/features/bit-rot/src/stub/bit-rot-stub.h   |    7 +-
7f4c2a
 9 files changed, 821 insertions(+), 207 deletions(-)
7f4c2a
 create mode 100644 xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
7f4c2a
 create mode 100644 xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h
7f4c2a
7f4c2a
diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
7f4c2a
index 242e487..099ae2c 100644
7f4c2a
--- a/libglusterfs/src/glfs-message-id.h
7f4c2a
+++ b/libglusterfs/src/glfs-message-id.h
7f4c2a
@@ -93,19 +93,19 @@
7f4c2a
 #define GLFS_MSGID_COMP_PS_END             (GLFS_MSGID_COMP_PS +\
7f4c2a
                                            GLFS_MSGID_SEGMENT)
7f4c2a
 
7f4c2a
-#define GLFS_MSGID_COMP_PERF               GLFS_MSGID_COMP_PS_END
7f4c2a
-#define GLFS_MSGID_COMP_PERF_END           (GLFS_MSGID_COMP_PERF +\
7f4c2a
+#define GLFS_MSGID_COMP_BITROT_STUB        GLFS_MSGID_COMP_PS_END
7f4c2a
+#define GLFS_MSGID_COMP_BITROT_STUB_END    (GLFS_MSGID_COMP_BITROT_STUB +\
7f4c2a
                                            GLFS_MSGID_SEGMENT)
7f4c2a
 
7f4c2a
-#define GLFS_MSGID_COMP_CHANGELOG          GLFS_MSGID_COMP_PERF_END
7f4c2a
+#define GLFS_MSGID_COMP_CHANGELOG          GLFS_MSGID_COMP_BITROT_STUB_END
7f4c2a
 #define GLFS_MSGID_COMP_CHANGELOG_END      (GLFS_MSGID_COMP_CHANGELOG +\
7f4c2a
                                            GLFS_MSGID_SEGMENT)
7f4c2a
 
7f4c2a
-#define GLFS_MSGID_COMP_BITROT             GLFS_MSGID_COMP_CHANGELOG_END
7f4c2a
-#define GLFS_MSGID_COMP_BITROT_END         (GLFS_MSGID_COMP_BITROT +\
7f4c2a
+#define GLFS_MSGID_COMP_BITROT_BITD        GLFS_MSGID_COMP_CHANGELOG_END
7f4c2a
+#define GLFS_MSGID_COMP_BITROT_BITD_END    (GLFS_MSGID_COMP_BITROT_BITD +\
7f4c2a
                                            GLFS_MSGID_SEGMENT)
7f4c2a
 
7f4c2a
-#define GLFS_MSGID_COMP_RPC_TRANS_SOCKET        GLFS_MSGID_COMP_BITROT_END
7f4c2a
+#define GLFS_MSGID_COMP_RPC_TRANS_SOCKET        GLFS_MSGID_COMP_BITROT_BITD_END
7f4c2a
 #define GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END    (GLFS_MSGID_COMP_RPC_TRANS_SOCKET + \
7f4c2a
                                                 GLFS_MSGID_SEGMENT)
7f4c2a
 
7f4c2a
diff --git a/xlators/features/bit-rot/src/bitd/Makefile.am b/xlators/features/bit-rot/src/bitd/Makefile.am
7f4c2a
index f67fa1a..fd42ebe 100644
7f4c2a
--- a/xlators/features/bit-rot/src/bitd/Makefile.am
7f4c2a
+++ b/xlators/features/bit-rot/src/bitd/Makefile.am
7f4c2a
@@ -13,7 +13,7 @@ bit_rot_la_SOURCES = bit-rot.c bit-rot-scrub.c bit-rot-tbf.c
7f4c2a
 bit_rot_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
7f4c2a
                     $(top_builddir)/xlators/features/changelog/lib/src/libgfchangelog.la
7f4c2a
 
7f4c2a
-noinst_HEADERS = bit-rot.h bit-rot-scrub.h bit-rot-tbf.h
7f4c2a
+noinst_HEADERS = bit-rot.h bit-rot-scrub.h bit-rot-tbf.h bit-rot-bitd-messages.h
7f4c2a
 
7f4c2a
 AM_CFLAGS = -Wall $(GF_CFLAGS)
7f4c2a
 
7f4c2a
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
7f4c2a
new file mode 100644
7f4c2a
index 0000000..af3a74f
7f4c2a
--- /dev/null
7f4c2a
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
7f4c2a
@@ -0,0 +1,391 @@
7f4c2a
+/*
7f4c2a
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
7f4c2a
+ This file is part of GlusterFS.
7f4c2a
+
7f4c2a
+ This file is licensed to you under your choice of the GNU Lesser
7f4c2a
+ General Public License, version 3 or any later version (LGPLv3 or
7f4c2a
+ later), or the GNU General Public License, version 2 (GPLv2), in all
7f4c2a
+ cases as published by the Free Software Foundation.
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#ifndef _BITROT_BITD_MESSAGES_H_
7f4c2a
+#define _BITROT_BITD_MESSAGES_H_
7f4c2a
+
7f4c2a
+#include "glfs-message-id.h"
7f4c2a
+
7f4c2a
+/* file bit-rot-bitd-messages.h
7f4c2a
+ * brief BIT-ROT log-message IDs and their descriptions
7f4c2a
+ */
7f4c2a
+
7f4c2a
+/* NOTE: Rules for message additions
7f4c2a
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
7f4c2a
+ *    if the message format is the same. Reasoning is that, if the message
7f4c2a
+ *    format needs to change in one instance, the other instances are not
7f4c2a
+ *    impacted or the new change does not change the ID of the instance being
7f4c2a
+ *    modified.
7f4c2a
+ * 2) Addition of a message,
7f4c2a
+ *       - Should increment the GLFS_NUM_MESSAGES
7f4c2a
+ *       - Append to the list of messages defined, towards the end
7f4c2a
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
7f4c2a
+ * NOTE: Rules for message format modifications
7f4c2a
+ * 3) Check acorss the code if the message ID macro in question is reused
7f4c2a
+ *    anywhere. If reused then then the modifications should ensure correctness
7f4c2a
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
7f4c2a
+ *    not used anywhere, proceed with the required modification.
7f4c2a
+ * NOTE: Rules for message deletion
7f4c2a
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
7f4c2a
+ *    anywhere, then can be deleted, but will leave a hole by design, as
7f4c2a
+ *    addition rules specify modification to the end of the list and not filling
7f4c2a
+ *    holes.
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#define GLFS_BITROT_BITD_BASE                   GLFS_MSGID_COMP_BITROT_BITD
7f4c2a
+#define GLFS_BITROT_BITD_NUM_MESSAGES           48
7f4c2a
+#define GLFS_MSGID_END                          (GLFS_BITROT_BITD_BASE + \
7f4c2a
+                                           GLFS_BITROT_BITD_NUM_MESSAGES + 1)
7f4c2a
+/* Messaged with message IDs */
7f4c2a
+#define glfs_msg_start_x  GLFS_BITROT_BITD_BASE, "Invalid: Start of messages"
7f4c2a
+/*------------*/
7f4c2a
+
7f4c2a
+
7f4c2a
+#define BRB_MSG_FD_CREATE_FAILED               (GLFS_BITROT_BITD_BASE + 1)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#define BRB_MSG_READV_FAILED                (GLFS_BITROT_BITD_BASE + 2)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#define BRB_MSG_BLOCK_READ_FAILED           (GLFS_BITROT_BITD_BASE + 3)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CALC_CHECKSUM_FAILED        (GLFS_BITROT_BITD_BASE + 4)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_NO_MEMORY                   (GLFS_BITROT_BITD_BASE + 5)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_GET_SIGN_FAILED             (GLFS_BITROT_BITD_BASE + 6)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SET_SIGN_FAILED             (GLFS_BITROT_BITD_BASE + 7)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_OP_FAILED                   (GLFS_BITROT_BITD_BASE + 8)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_READ_AND_SIGN_FAILED        (GLFS_BITROT_BITD_BASE + 9)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SIGN_FAILED                 (GLFS_BITROT_BITD_BASE + 10)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_GET_SUBVOL_FAILED           (GLFS_BITROT_BITD_BASE + 11)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SET_TIMER_FAILED            (GLFS_BITROT_BITD_BASE + 12)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_GET_INFO_FAILED             (GLFS_BITROT_BITD_BASE + 13)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_PATH_FAILED                 (GLFS_BITROT_BITD_BASE + 14)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_MARK_BAD_FILE               (GLFS_BITROT_BITD_BASE + 15)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_TRIGGER_SIGN                (GLFS_BITROT_BITD_BASE + 16)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_REGISTER_FAILED             (GLFS_BITROT_BITD_BASE + 17)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CRAWLING_START              (GLFS_BITROT_BITD_BASE + 18)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SPAWN_FAILED                (GLFS_BITROT_BITD_BASE + 19)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_INVALID_SUBVOL_CHILD        (GLFS_BITROT_BITD_BASE + 20)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SKIP_OBJECT                 (GLFS_BITROT_BITD_BASE + 21)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_NO_CHILD                    (GLFS_BITROT_BITD_BASE + 22)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CHECKSUM_MISMATCH           (GLFS_BITROT_BITD_BASE + 23)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_MARK_CORRUPTED              (GLFS_BITROT_BITD_BASE + 24)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CRAWLING_FINISH               (GLFS_BITROT_BITD_BASE + 25)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CALC_ERROR                  (GLFS_BITROT_BITD_BASE + 26)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_LOOKUP_FAILED               (GLFS_BITROT_BITD_BASE + 27)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_PARTIAL_VERSION_PRESENCE    (GLFS_BITROT_BITD_BASE + 28)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_MEM_ACNT_FAILED             (GLFS_BITROT_BITD_BASE + 29)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_TIMER_WHEEL_UNAVAILABLE     (GLFS_BITROT_BITD_BASE + 30)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_BITROT_LOADED               (GLFS_BITROT_BITD_BASE + 31)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCALE_DOWN_FAILED           (GLFS_BITROT_BITD_BASE + 32)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCALE_UP_FAILED             (GLFS_BITROT_BITD_BASE + 33)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCALE_DOWN_SCRUBBER         (GLFS_BITROT_BITD_BASE + 34)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCALING_UP_SCRUBBER         (GLFS_BITROT_BITD_BASE + 35)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_UNKNOWN_THROTTLE            (GLFS_BITROT_BITD_BASE + 36)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_RATE_LIMIT_INFO             (GLFS_BITROT_BITD_BASE + 37)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCRUB_INFO                  (GLFS_BITROT_BITD_BASE + 38)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_CONNECTED_TO_BRICK          (GLFS_BITROT_BITD_BASE + 39)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_BRICK_INFO                  (GLFS_BITROT_BITD_BASE + 40)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SUBVOL_CONNECT_FAILED       (GLFS_BITROT_BITD_BASE + 41)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_INVALID_SUBVOL              (GLFS_BITROT_BITD_BASE + 42)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_RESCHEDULE_SCRUBBER_FAILED  (GLFS_BITROT_BITD_BASE + 43)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#define BRB_MSG_SCRUB_START                 (GLFS_BITROT_BITD_BASE + 44)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCRUB_FINISH                (GLFS_BITROT_BITD_BASE + 45)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCRUB_RUNNING               (GLFS_BITROT_BITD_BASE + 46)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCRUB_RESCHEDULED           (GLFS_BITROT_BITD_BASE + 47)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRB_MSG_SCRUB_TUNABLE              (GLFS_BITROT_BITD_BASE + 48)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+/*------------*/
7f4c2a
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
7f4c2a
+#endif /* !_BITROT_BITD_MESSAGES_H_ */
7f4c2a
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
7f4c2a
index 2da4530..45499de 100644
7f4c2a
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
7f4c2a
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
7f4c2a
@@ -23,6 +23,7 @@
7f4c2a
 
7f4c2a
 #include "bit-rot-scrub.h"
7f4c2a
 #include <pthread.h>
7f4c2a
+#include "bit-rot-bitd-messages.h"
7f4c2a
 
7f4c2a
 struct br_scrubbers {
7f4c2a
         pthread_t scrubthread;
7f4c2a
@@ -63,7 +64,7 @@ bitd_fetch_signature (xlator_t *this, br_child_t *child,
7f4c2a
         ret = dict_get_ptr
7f4c2a
                 (*xattr, GLUSTERFS_GET_OBJECT_SIGNATURE, (void **) sign);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
7f4c2a
                         "failed to extract signature info [GFID: %s]",
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto unref_dict;
7f4c2a
@@ -111,12 +112,12 @@ bitd_scrub_post_compute_check (xlator_t *this,
7f4c2a
          * The log entry looks pretty ugly, but helps in debugging..
7f4c2a
          */
7f4c2a
         if (signptr->stale || (signptr->version != version)) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                        "<STAGE: POST> Object [GFID: %s] either has a stale "
7f4c2a
-                        "signature OR underwent signing during checksumming "
7f4c2a
-                        "{Stale: %d | Version: %lu,%lu}",
7f4c2a
-                        uuid_utoa (fd->inode->gfid), (signptr->stale) ? 1 : 0,
7f4c2a
-                        version, signptr->version);
7f4c2a
+                gf_msg_debug (this->name, 0, "<STAGE: POST> Object [GFID: %s] "
7f4c2a
+                              "either has a stale signature OR underwent "
7f4c2a
+                              "signing during checksumming {Stale: %d | "
7f4c2a
+                              "Version: %lu,%lu}", uuid_utoa (fd->inode->gfid),
7f4c2a
+                              (signptr->stale) ? 1 : 0, version,
7f4c2a
+                              signptr->version);
7f4c2a
                 ret = -1;
7f4c2a
                 goto unref_dict;
7f4c2a
         }
7f4c2a
@@ -177,7 +178,7 @@ bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
7f4c2a
         int32_t ret   = -1;
7f4c2a
 
7f4c2a
         if (bitd_is_bad_file (this, child, NULL, fd)) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SKIP_OBJECT,
7f4c2a
                         "Object [GFID: %s] is marked corrupted, skipping..",
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto out;
7f4c2a
@@ -185,9 +186,9 @@ bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
7f4c2a
 
7f4c2a
         ret = bitd_signature_staleness (this, child, fd, &stale, version);
7f4c2a
         if (!ret && stale) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                        "<STAGE: PRE> Object [GFID: %s] has stale signature",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg_debug (this->name, 0, "<STAGE: PRE> Object [GFID: %s] "
7f4c2a
+                              "has stale signature",
7f4c2a
+                              uuid_utoa (fd->inode->gfid));
7f4c2a
                 ret = -1;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -215,13 +216,14 @@ bitd_compare_ckum (xlator_t *this,
7f4c2a
 
7f4c2a
         if (strncmp
7f4c2a
             (sign->signature, (char *) md, strlen (sign->signature)) == 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG, "%s [GFID: %s | Brick: %s] "
7f4c2a
-                        "matches calculated checksum", loc->path,
7f4c2a
-                        uuid_utoa (linked_inode->gfid), child->brick_path);
7f4c2a
+                gf_msg_debug (this->name, 0, "%s [GFID: %s | Brick: %s] "
7f4c2a
+                              "matches calculated checksum", loc->path,
7f4c2a
+                              uuid_utoa (linked_inode->gfid),
7f4c2a
+                              child->brick_path);
7f4c2a
                 return 0;
7f4c2a
         }
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_ALERT,
7f4c2a
+        gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_CHECKSUM_MISMATCH,
7f4c2a
                 "Object checksum mismatch: %s [GFID: %s | Brick: %s]",
7f4c2a
                 loc->path, uuid_utoa (linked_inode->gfid), child->brick_path);
7f4c2a
 
7f4c2a
@@ -234,19 +236,19 @@ bitd_compare_ckum (xlator_t *this,
7f4c2a
 
7f4c2a
         ret = dict_set_int32 (xattr, BITROT_OBJECT_BAD_KEY, _gf_true);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_MARK_BAD_FILE,
7f4c2a
                         "Error setting bad-file marker for %s [GFID: %s | "
7f4c2a
                         "Brick: %s]", loc->path, uuid_utoa (linked_inode->gfid),
7f4c2a
                         child->brick_path);
7f4c2a
                 goto dictfree;
7f4c2a
         }
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO, "Marking %s [GFID: %s | Brick: %s] "
7f4c2a
-                "as corrupted..", loc->path, uuid_utoa (linked_inode->gfid),
7f4c2a
-                child->brick_path);
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_MARK_CORRUPTED, "Marking %s"
7f4c2a
+                " [GFID: %s | Brick: %s] as corrupted..", loc->path,
7f4c2a
+                uuid_utoa (linked_inode->gfid), child->brick_path);
7f4c2a
         ret = syncop_fsetxattr (child->xl, fd, xattr, 0, NULL, NULL);
7f4c2a
         if (ret)
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_MARK_BAD_FILE,
7f4c2a
                         "Error marking object %s [GFID: %s] as corrupted",
7f4c2a
                         loc->path, uuid_utoa (linked_inode->gfid));
7f4c2a
 
7f4c2a
@@ -308,12 +310,12 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
7f4c2a
         if (linked_inode)
7f4c2a
                 inode_lookup (linked_inode);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG, "Scrubbing object %s [GFID: %s]",
7f4c2a
-                entry->d_name, uuid_utoa (linked_inode->gfid));
7f4c2a
+        gf_msg_debug (this->name, 0, "Scrubbing object %s [GFID: %s]",
7f4c2a
+                      entry->d_name, uuid_utoa (linked_inode->gfid));
7f4c2a
 
7f4c2a
         if (iatt.ia_type != IA_IFREG) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG, "%s is not a regular "
7f4c2a
-                        "file", entry->d_name);
7f4c2a
+                gf_msg_debug (this->name, 0, "%s is not a regular file",
7f4c2a
+                              entry->d_name);
7f4c2a
                 ret = 0;
7f4c2a
                 goto unref_inode;
7f4c2a
         }
7f4c2a
@@ -323,8 +325,9 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
7f4c2a
          */
7f4c2a
         fd = fd_create (linked_inode, 0);
7f4c2a
         if (!fd) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to create fd for "
7f4c2a
-                        "inode %s", uuid_utoa (linked_inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
7f4c2a
+                        "failed to create fd for inode %s",
7f4c2a
+                        uuid_utoa (linked_inode->gfid));
7f4c2a
                 goto unref_inode;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -355,8 +358,9 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
7f4c2a
 
7f4c2a
         ret = br_calculate_obj_checksum (md, child, fd, &iatt);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "error calculating hash "
7f4c2a
-                        "for object [GFID: %s]", uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_CALC_ERROR,
7f4c2a
+                        "error calculating hash for object [GFID: %s]",
7f4c2a
+                        uuid_utoa (fd->inode->gfid));
7f4c2a
                 ret = -1;
7f4c2a
                 goto free_md;
7f4c2a
         }
7f4c2a
@@ -517,8 +521,15 @@ br_fsscanner_log_time (xlator_t *this, br_child_t *child, const char *sfx)
7f4c2a
         gettimeofday (&tv, NULL);
7f4c2a
         gf_time_fmt (timestr, sizeof (timestr), tv.tv_sec, gf_timefmt_FT);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO,
7f4c2a
-                "Scrubbing \"%s\" %s at %s", child->brick_path, sfx, timestr);
7f4c2a
+        if (strcasecmp (sfx, "started") == 0) {
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_START,
7f4c2a
+                        "Scrubbing \"%s\" %s at %s", child->brick_path, sfx,
7f4c2a
+                        timestr);
7f4c2a
+        } else {
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_FINISH,
7f4c2a
+                        "Scrubbing \"%s\" %s at %s", child->brick_path, sfx,
7f4c2a
+                        timestr);
7f4c2a
+        }
7f4c2a
 }
7f4c2a
 
7f4c2a
 static void
7f4c2a
@@ -675,8 +686,8 @@ br_fsscan_schedule (xlator_t *this, br_child_t *child,
7f4c2a
 
7f4c2a
         gf_time_fmt (timestr, sizeof (timestr),
7f4c2a
                      (fsscan->boot + timo), gf_timefmt_FT);
7f4c2a
-        gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s scheduled to "
7f4c2a
-                "run at %s", child->brick_path, timestr);
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, "Scrubbing for "
7f4c2a
+                "%s scheduled to run at %s", child->brick_path, timestr);
7f4c2a
 
7f4c2a
         return 0;
7f4c2a
 
7f4c2a
@@ -711,11 +722,12 @@ br_fsscan_reschedule (xlator_t *this,
7f4c2a
                 ret = gf_tw_mod_timer (priv->timer_wheel, fsscan->timer, timo);
7f4c2a
 
7f4c2a
         if (!ret && pendingcheck)
7f4c2a
-                gf_log (this->name, GF_LOG_INFO,
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_RUNNING,
7f4c2a
                         "Scrubber for %s is currently running and would be "
7f4c2a
                         "rescheduled after completion", child->brick_path);
7f4c2a
         else
7f4c2a
-                gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled "
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_RESCHEDULED,
7f4c2a
+                        "Scrubbing for %s rescheduled "
7f4c2a
                         "to run at %s", child->brick_path, timestr);
7f4c2a
 
7f4c2a
         return 0;
7f4c2a
@@ -758,7 +770,7 @@ br_scrubber_calc_scale (xlator_t *this,
7f4c2a
                               pow (M_E, BR_SCRUB_THREAD_SCALE_AGGRESSIVE);
7f4c2a
                 break;
7f4c2a
         default:
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_UNKNOWN_THROTTLE,
7f4c2a
                         "Unknown throttle %d", throttle);
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -933,7 +945,7 @@ br_scrubber_scale_up (xlator_t *this,
7f4c2a
 
7f4c2a
         diff = (int)(v2 - v1);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO,
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCALING_UP_SCRUBBER,
7f4c2a
                 "Scaling up scrubbers [%d => %d]", v1, v2);
7f4c2a
 
7f4c2a
         for (i = 0; i < diff; i++) {
7f4c2a
@@ -956,7 +968,7 @@ br_scrubber_scale_up (xlator_t *this,
7f4c2a
                 goto error_return;
7f4c2a
 
7f4c2a
         if (i != diff) /* degraded scaling.. */
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SCALE_UP_FAILED,
7f4c2a
                         "Could not fully scale up to %d scrubber(s). Spawned "
7f4c2a
                         "%d/%d [total scrubber(s): %d]", v2, i, diff, (v1 + i));
7f4c2a
 
7f4c2a
@@ -978,7 +990,7 @@ br_scrubber_scale_down (xlator_t *this,
7f4c2a
 
7f4c2a
         diff = (int)(v1 - v2);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO,
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCALE_DOWN_SCRUBBER,
7f4c2a
                 "Scaling down scrubbers [%d => %d]", v1, v2);
7f4c2a
 
7f4c2a
         for (i = 0 ; i < diff; i++) {
7f4c2a
@@ -995,10 +1007,10 @@ br_scrubber_scale_down (xlator_t *this,
7f4c2a
         }
7f4c2a
 
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
-                        "Could not fully scale down to %d scrubber(s). "
7f4c2a
-                        "Terminated %d/%d [total scrubber(s): %d]",
7f4c2a
-                        v1, i, diff, (v2 - i));
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0,
7f4c2a
+                        BRB_MSG_SCALE_DOWN_FAILED, "Could not fully scale down "
7f4c2a
+                        "to %d scrubber(s). Terminated %d/%d [total "
7f4c2a
+                        "scrubber(s): %d]", v1, i, diff, (v2 - i));
7f4c2a
                 ret = 0;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1162,8 +1174,9 @@ static void br_scrubber_log_option (xlator_t *this,
7f4c2a
         if (scrubstall)
7f4c2a
                 return; /* logged as pause */
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO, "SCRUB TUNABLES:: [Frequency: %s, "
7f4c2a
-                "Throttle: %s]", scrub_freq_str[fsscrub->frequency],
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, "SCRUB "
7f4c2a
+                "TUNABLES:: [Frequency: %s, Throttle: %s]",
7f4c2a
+                scrub_freq_str[fsscrub->frequency],
7f4c2a
                 scrub_throttle_str[fsscrub->throttle]);
7f4c2a
 }
7f4c2a
 
7f4c2a
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
7f4c2a
index 228cf34..c06a5c1 100644
7f4c2a
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
7f4c2a
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
7f4c2a
@@ -24,6 +24,7 @@
7f4c2a
 #include "bit-rot.h"
7f4c2a
 #include "bit-rot-scrub.h"
7f4c2a
 #include <pthread.h>
7f4c2a
+#include "bit-rot-bitd-messages.h"
7f4c2a
 
7f4c2a
 #include "tw.h"
7f4c2a
 
7f4c2a
@@ -179,8 +180,8 @@ bitd_is_bad_file (xlator_t *this, br_child_t *child, loc_t *loc, fd_t *fd)
7f4c2a
                                        NULL);
7f4c2a
 
7f4c2a
         if (!ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG, "[GFID: %s] is marked "
7f4c2a
-                        "corrupted", uuid_utoa (inode->gfid));
7f4c2a
+                gf_msg_debug (this->name, 0, "[GFID: %s] is marked corrupted",
7f4c2a
+                              uuid_utoa (inode->gfid));
7f4c2a
                 bad_file = _gf_true;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -257,8 +258,9 @@ br_object_open (xlator_t *this,
7f4c2a
         ret = -EINVAL;
7f4c2a
         fd = fd_create (inode, 0);
7f4c2a
         if (!fd) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to create fd for the "
7f4c2a
-                        "inode %s", uuid_utoa (inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
7f4c2a
+                        "failed to create fd for the inode %s",
7f4c2a
+                        uuid_utoa (inode->gfid));
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -313,8 +315,8 @@ br_object_read_block_and_sign (xlator_t *this, fd_t *fd, br_child_t *child,
7f4c2a
                             NULL);
7f4c2a
 
7f4c2a
         if (ret < 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "readv on %s failed (%s)",
7f4c2a
-                        uuid_utoa (fd->inode->gfid), strerror (errno));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, errno, BRB_MSG_READV_FAILED,
7f4c2a
+                        "readv on %s failed", uuid_utoa (fd->inode->gfid));
7f4c2a
                 ret = -1;
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -364,7 +366,8 @@ br_calculate_obj_checksum (unsigned char *md,
7f4c2a
                 ret = br_object_read_block_and_sign (this, fd, child,
7f4c2a
                                                      offset, block, &sha256);
7f4c2a
                 if (ret < 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "reading block with "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRB_MSG_BLOCK_READ_FAILED, "reading block with "
7f4c2a
                                 "offset %lu of object %s failed", offset,
7f4c2a
                                 uuid_utoa (fd->inode->gfid));
7f4c2a
                         break;
7f4c2a
@@ -408,24 +411,27 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object,
7f4c2a
 
7f4c2a
         md = GF_CALLOC (SHA256_DIGEST_LENGTH, sizeof (*md), gf_common_mt_char);
7f4c2a
         if (!md) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate memory "
7f4c2a
-                        "for saving hash of the object %s",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
7f4c2a
+                        "failed to allocate memory for saving hash of the "
7f4c2a
+                        "object %s", uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         ret = br_object_checksum (md, object, fd, iatt);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "calculating checksum for "
7f4c2a
-                        "the object %s failed", uuid_utoa (linked_inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRB_MSG_CALC_CHECKSUM_FAILED, "calculating checksum "
7f4c2a
+                        "for the object %s failed",
7f4c2a
+                        uuid_utoa (linked_inode->gfid));
7f4c2a
                 goto free_signature;
7f4c2a
         }
7f4c2a
 
7f4c2a
         sign = br_prepare_signature (md, SHA256_DIGEST_LENGTH,
7f4c2a
                                      BR_SIGNATURE_TYPE_SHA256, object);
7f4c2a
         if (!sign) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the signature "
7f4c2a
-                        "for the object %s", uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
7f4c2a
+                        "failed to get the signature for the object %s",
7f4c2a
+                        uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto free_signature;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -434,16 +440,17 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object,
7f4c2a
                  (void *)sign, signature_size (SHA256_DIGEST_LENGTH));
7f4c2a
 
7f4c2a
         if (!xattr) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "dict allocation for signing"
7f4c2a
-                        " failed for the object %s",
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_SIGN_FAILED,
7f4c2a
+                        "dict allocation for signing failed for the object %s",
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto free_isign;
7f4c2a
         }
7f4c2a
 
7f4c2a
         ret = syncop_fsetxattr (object->child->xl, fd, xattr, 0, NULL, NULL);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "fsetxattr of signature to "
7f4c2a
-                        "the object %s failed", uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_SIGN_FAILED,
7f4c2a
+                        "fsetxattr of signature to the object %s failed",
7f4c2a
+                        uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto unref_dict;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -469,9 +476,14 @@ void
7f4c2a
 br_log_object (xlator_t *this, char *op, uuid_t gfid, int32_t op_errno)
7f4c2a
 {
7f4c2a
         int softerror = br_object_sign_softerror (op_errno);
7f4c2a
-        gf_log (this->name, (softerror) ? GF_LOG_DEBUG : GF_LOG_ERROR,
7f4c2a
-                "%s() failed on object %s [reason: %s]",
7f4c2a
-                op, uuid_utoa (gfid), strerror (op_errno));
7f4c2a
+        if (softerror) {
7f4c2a
+                gf_msg_debug (this->name, 0, "%s() failed on object %s "
7f4c2a
+                              "[reason: %s]", op, uuid_utoa (gfid),
7f4c2a
+                              strerror (op_errno));
7f4c2a
+        } else {
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, op_errno, BRB_MSG_OP_FAILED,
7f4c2a
+                        "%s() failed on object %s", op, uuid_utoa (gfid));
7f4c2a
+        }
7f4c2a
 }
7f4c2a
 
7f4c2a
 void
7f4c2a
@@ -479,9 +491,13 @@ br_log_object_path (xlator_t *this, char *op,
7f4c2a
                     const char *path, int32_t op_errno)
7f4c2a
 {
7f4c2a
         int softerror = br_object_sign_softerror (op_errno);
7f4c2a
-        gf_log (this->name, (softerror) ? GF_LOG_DEBUG : GF_LOG_ERROR,
7f4c2a
-                "%s() failed on object %s [reason: %s]",
7f4c2a
-                op, path, strerror (op_errno));
7f4c2a
+        if (softerror) {
7f4c2a
+                gf_msg_debug (this->name, 0, "%s() failed on object %s "
7f4c2a
+                              "[reason: %s]", op, path, strerror (op_errno));
7f4c2a
+        } else {
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, op_errno, BRB_MSG_OP_FAILED,
7f4c2a
+                        "%s() failed on object %s", op, path);
7f4c2a
+        }
7f4c2a
 }
7f4c2a
 
7f4c2a
 static void
7f4c2a
@@ -509,8 +525,9 @@ br_trigger_sign (xlator_t *this, br_child_t *child,
7f4c2a
         ret = -1;
7f4c2a
         fd = fd_create (linked_inode, 0);
7f4c2a
         if (!fd) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to create fd "
7f4c2a
-                        "[GFID %s]", uuid_utoa (linked_inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
7f4c2a
+                        "Failed to create fd [GFID %s]",
7f4c2a
+                        uuid_utoa (linked_inode->gfid));
7f4c2a
                 goto cleanup_dict;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -534,7 +551,7 @@ br_trigger_sign (xlator_t *this, br_child_t *child,
7f4c2a
         dict_unref (dict);
7f4c2a
  out:
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_TRIGGER_SIGN,
7f4c2a
                         "Could not trigger signingd for %s (reopen hint: %d)",
7f4c2a
                         uuid_utoa (linked_inode->gfid), val);
7f4c2a
         }
7f4c2a
@@ -610,13 +627,14 @@ static inline int32_t br_sign_object (br_object_t *object)
7f4c2a
          * we have an open file descriptor on the object. from here on,
7f4c2a
          * do not be generous to file operation errors.
7f4c2a
          */
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                "Signing object [%s]", uuid_utoa (linked_inode->gfid));
7f4c2a
+        gf_msg_debug (this->name, 0, "Signing object [%s]",
7f4c2a
+                      uuid_utoa (linked_inode->gfid));
7f4c2a
 
7f4c2a
         ret = br_object_read_sign (linked_inode, fd, object, &iatt);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "reading and signing of the "
7f4c2a
-                        "object %s failed", uuid_utoa (linked_inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRB_MSG_READ_AND_SIGN_FAILED, "reading and signing of "
7f4c2a
+                        "the object %s failed", uuid_utoa (linked_inode->gfid));
7f4c2a
                 goto unref_fd;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -670,8 +688,8 @@ br_process_object (void *arg)
7f4c2a
 
7f4c2a
                 ret = br_sign_object (object);
7f4c2a
                 if (ret && !br_object_sign_softerror (-ret))
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "SIGNING FAILURE [%s]",
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRB_MSG_SIGN_FAILED, "SIGNING FAILURE [%s]",
7f4c2a
                                 uuid_utoa (object->gfid));
7f4c2a
                 GF_FREE (object);
7f4c2a
         }
7f4c2a
@@ -795,32 +813,34 @@ br_brick_callback (void *xl, char *brick,
7f4c2a
 
7f4c2a
         gf_uuid_copy (gfid, ev->u.releasebr.gfid);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                "RELEASE EVENT [GFID %s]", uuid_utoa (gfid));
7f4c2a
+        gf_msg_debug (this->name, 0, "RELEASE EVENT [GFID %s]",
7f4c2a
+                      uuid_utoa (gfid));
7f4c2a
 
7f4c2a
         child = br_get_child_from_brick_path (this, brick);
7f4c2a
         if (!child) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the subvolume "
7f4c2a
-                        "for the brick %s", brick);
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SUBVOL_FAILED,
7f4c2a
+                        "failed to get the subvolume for the brick %s", brick);
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         object = br_initialize_object (this, child, ev);
7f4c2a
         if (!object) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate "
7f4c2a
-                        "object memory [GFID: %s]", uuid_utoa (gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
7f4c2a
+                        "failed to allocate object memory [GFID: %s]",
7f4c2a
+                        uuid_utoa (gfid));
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         timer = br_initialize_timer (this, object, child, ev);
7f4c2a
         if (!timer) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate "
7f4c2a
-                        "object expiry timer [GFID: %s]", uuid_utoa (gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_TIMER_FAILED,
7f4c2a
+                        "failed to allocate object expiry timer [GFID: %s]",
7f4c2a
+                        uuid_utoa (gfid));
7f4c2a
                 goto free_object;
7f4c2a
         }
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG, "->callback: brick [%s], type [%d]\n",
7f4c2a
-                brick, ev->ev_type);
7f4c2a
+        gf_msg_debug (this->name, 0, "->callback: brick [%s], type [%d]\n",
7f4c2a
+                      brick, ev->ev_type);
7f4c2a
 
7f4c2a
         return;
7f4c2a
 
7f4c2a
@@ -867,7 +887,7 @@ br_check_object_need_sign (xlator_t *this, dict_t *xattr, br_child_t *child)
7f4c2a
         ret = dict_get_ptr (xattr, GLUSTERFS_GET_OBJECT_SIGNATURE,
7f4c2a
                             (void **)&sign;;
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
7f4c2a
                         "failed to get object signature info");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -895,8 +915,8 @@ br_prepare_loc (xlator_t *this, br_child_t *child, loc_t *parent,
7f4c2a
         else {
7f4c2a
                 loc->inode = inode;
7f4c2a
                 if (loc->inode->ia_type != IA_IFREG) {
7f4c2a
-                        gf_log (this->name, GF_LOG_DEBUG, "%s is not a regular "
7f4c2a
-                                "file", entry->d_name);
7f4c2a
+                        gf_msg_debug (this->name, 0, "%s is not a regular "
7f4c2a
+                                      "file", entry->d_name);
7f4c2a
                         ret = 0;
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -907,8 +927,8 @@ br_prepare_loc (xlator_t *this, br_child_t *child, loc_t *parent,
7f4c2a
 
7f4c2a
         ret = inode_path (parent->inode, entry->d_name, (char **)&loc->path);
7f4c2a
         if (ret < 0 || !loc->path) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "inode_path on %s "
7f4c2a
-                        "(parent: %s) failed", entry->d_name,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_PATH_FAILED,
7f4c2a
+                        "inode_path on %s (parent: %s) failed", entry->d_name,
7f4c2a
                         uuid_utoa (parent->inode->gfid));
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -969,8 +989,8 @@ bitd_oneshot_crawl (xlator_t *subvol,
7f4c2a
                 inode_lookup (linked_inode);
7f4c2a
 
7f4c2a
         if (iatt.ia_type != IA_IFREG) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                        "%s is not a regular file, skipping..", entry->d_name);
7f4c2a
+                gf_msg_debug (this->name, 0,  "%s is not a regular file, "
7f4c2a
+                              "skipping..", entry->d_name);
7f4c2a
                 ret = 0;
7f4c2a
                 goto unref_inode;
7f4c2a
         }
7f4c2a
@@ -992,7 +1012,7 @@ bitd_oneshot_crawl (xlator_t *subvol,
7f4c2a
          */
7f4c2a
 
7f4c2a
         if (bitd_is_bad_file (this, child, &loc, NULL)) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SKIP_OBJECT,
7f4c2a
                         "Entry [%s] is marked corrupted.. skipping.", loc.path);
7f4c2a
                 goto unref_inode;
7f4c2a
         }
7f4c2a
@@ -1010,9 +1030,10 @@ bitd_oneshot_crawl (xlator_t *subvol,
7f4c2a
                 if (op_errno == ENODATA && (iatt.ia_size != 0))
7f4c2a
                         need_signing = _gf_true;
7f4c2a
                 if (op_errno == EINVAL)
7f4c2a
-                        gf_log (this->name, GF_LOG_WARNING, "Partial version "
7f4c2a
-                                "xattr presence detected, ignoring [GFID: %s]",
7f4c2a
-                                uuid_utoa (linked_inode->gfid));
7f4c2a
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
7f4c2a
+                                BRB_MSG_PARTIAL_VERSION_PRESENCE, "Partial "
7f4c2a
+                                "version xattr presence detected, ignoring "
7f4c2a
+                                "[GFID: %s]", uuid_utoa (linked_inode->gfid));
7f4c2a
         } else {
7f4c2a
                 need_signing = br_check_object_need_sign (this, xattr, child);
7f4c2a
         }
7f4c2a
@@ -1020,7 +1041,7 @@ bitd_oneshot_crawl (xlator_t *subvol,
7f4c2a
         if (!need_signing)
7f4c2a
                 goto unref_dict;
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO,
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_TRIGGER_SIGN,
7f4c2a
                 "Triggering signing for %s [GFID: %s | Brick: %s]",
7f4c2a
                 loc.path, uuid_utoa (linked_inode->gfid), child->brick_path);
7f4c2a
         br_trigger_sign (this, child, linked_inode, &loc, _gf_true);
7f4c2a
@@ -1053,8 +1074,9 @@ br_oneshot_signer (void *arg)
7f4c2a
 
7f4c2a
         THIS = this;
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO, "Crawling brick [%s], scanning "
7f4c2a
-                "for unsigned objects", child->brick_path);
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CRAWLING_START,
7f4c2a
+                "Crawling brick [%s], scanning for unsigned objects",
7f4c2a
+                child->brick_path);
7f4c2a
 
7f4c2a
         loc.inode = child->table->root;
7f4c2a
         (void) syncop_ftw_throttle
7f4c2a
@@ -1062,7 +1084,7 @@ br_oneshot_signer (void *arg)
7f4c2a
                          GF_CLIENT_PID_BITD, child, bitd_oneshot_crawl,
7f4c2a
                          BR_CRAWL_THROTTLE_COUNT, BR_CRAWL_THROTTLE_ZZZ);
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_INFO,
7f4c2a
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CRAWLING_FINISH,
7f4c2a
                 "Completed crawling brick [%s]", child->brick_path);
7f4c2a
 
7f4c2a
         return NULL;
7f4c2a
@@ -1097,15 +1119,16 @@ br_enact_signer (xlator_t *this, br_child_t *child, br_stub_init_t *stub)
7f4c2a
         ret = gf_changelog_register_generic
7f4c2a
                          (brick, 1, 1, this->ctx->cmd_args.log_file, -1, this);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Register to changelog failed"
7f4c2a
-                        " [Reason: %s]", strerror (errno));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                        BRB_MSG_REGISTER_FAILED, "Register to changelog "
7f4c2a
+                        "failed");
7f4c2a
                 goto dealloc;
7f4c2a
         }
7f4c2a
 
7f4c2a
         child->threadrunning = 0;
7f4c2a
         ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child);
7f4c2a
         if (ret)
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SPAWN_FAILED,
7f4c2a
                         "failed to spawn FS crawler thread");
7f4c2a
         else
7f4c2a
                 child->threadrunning = 1;
7f4c2a
@@ -1148,8 +1171,9 @@ br_enact_scrubber (xlator_t *this, br_child_t *child)
7f4c2a
 
7f4c2a
         ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child);
7f4c2a
         if (ret != 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_ALERT, "failed to spawn bitrot "
7f4c2a
-                        "scrubber daemon [Brick: %s]", child->brick_path);
7f4c2a
+                gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_SPAWN_FAILED,
7f4c2a
+                        "failed to spawn bitrot scrubber daemon [Brick: %s]",
7f4c2a
+                        child->brick_path);
7f4c2a
                 goto error_return;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1211,8 +1235,8 @@ br_brick_connect (xlator_t *this, br_child_t *child)
7f4c2a
         if (ret) {
7f4c2a
                 op_errno = -ret;
7f4c2a
                 ret = -1;
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "lookup on root failed "
7f4c2a
-                        "[Reason: %s]", strerror (op_errno));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, op_errno,
7f4c2a
+                        BRB_MSG_LOOKUP_FAILED, "lookup on root failed");
7f4c2a
                 goto wipeloc;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1221,15 +1245,15 @@ br_brick_connect (xlator_t *this, br_child_t *child)
7f4c2a
         if (ret) {
7f4c2a
                 op_errno = -ret;
7f4c2a
                 ret = -1;
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get stub info "
7f4c2a
-                        "[Reason: %s]", strerror (op_errno));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, op_errno,
7f4c2a
+                        BRB_MSG_GET_INFO_FAILED, "failed to get stub info");
7f4c2a
                 goto wipeloc;
7f4c2a
         }
7f4c2a
 
7f4c2a
         ret = dict_get_ptr (xattr, GLUSTERFS_GET_BR_STUB_INIT_TIME,
7f4c2a
                             (void **)&stub);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_INFO_FAILED,
7f4c2a
                         "failed to extract stub information");
7f4c2a
                 goto free_dict;
7f4c2a
         }
7f4c2a
@@ -1244,7 +1268,7 @@ br_brick_connect (xlator_t *this, br_child_t *child)
7f4c2a
                 ret = br_enact_signer (this, child, stub);
7f4c2a
 
7f4c2a
         if (!ret)
7f4c2a
-                gf_log (this->name, GF_LOG_INFO,
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CONNECTED_TO_BRICK,
7f4c2a
                         "Connected to brick %s..", child->brick_path);
7f4c2a
 
7f4c2a
  free_dict:
7f4c2a
@@ -1293,8 +1317,9 @@ br_handle_events (void *arg)
7f4c2a
 
7f4c2a
                 ret = br_brick_connect (this, child);
7f4c2a
                 if (ret)
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "failed to connect "
7f4c2a
-                                "to subvolume %s", child->xl->name);
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRB_MSG_SUBVOL_CONNECT_FAILED, "failed to "
7f4c2a
+                                "connect to subvolume %s", child->xl->name);
7f4c2a
         }
7f4c2a
 
7f4c2a
         return NULL;
7f4c2a
@@ -1311,8 +1336,8 @@ mem_acct_init (xlator_t *this)
7f4c2a
         ret = xlator_mem_acct_init (this, gf_br_stub_mt_end + 1);
7f4c2a
 
7f4c2a
         if (ret != 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING, "Memory accounting"
7f4c2a
-                        " init failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_MEM_ACNT_FAILED,
7f4c2a
+                        "Memory accounting init failed");
7f4c2a
                 return ret;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1330,15 +1355,16 @@ notify (xlator_t *this, int32_t event, void *data, ...)
7f4c2a
         subvol = (xlator_t *)data;
7f4c2a
         priv = this->private;
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_TRACE, "Notification received: %d", event);
7f4c2a
+        gf_msg_trace (this->name, 0, "Notification received: %d", event);
7f4c2a
 
7f4c2a
         idx = br_find_child_index (this, subvol);
7f4c2a
 
7f4c2a
         switch (event) {
7f4c2a
         case GF_EVENT_CHILD_UP:
7f4c2a
                 if (idx < 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "Got event %d from invalid subvolume", event);
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRB_MSG_INVALID_SUBVOL, "Got event %d from "
7f4c2a
+                                "invalid subvolume", event);
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
 
7f4c2a
@@ -1366,7 +1392,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
7f4c2a
 
7f4c2a
         case GF_EVENT_CHILD_DOWN:
7f4c2a
                 if (idx < 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRB_MSG_INVALID_SUBVOL_CHILD,
7f4c2a
                                 "Got event %d from invalid subvolume", event);
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -1430,8 +1457,9 @@ br_init_signer (xlator_t *this, br_private_t *priv)
7f4c2a
                 ret = gf_thread_create (&priv->obj_queue->workers[i], NULL,
7f4c2a
                                         br_process_object, this);
7f4c2a
                 if (ret != 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "thread creation failed (%s)", strerror (-ret));
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, -ret,
7f4c2a
+                                BRB_MSG_SPAWN_FAILED, "thread creation"
7f4c2a
+                                " failed");
7f4c2a
                         ret = -1;
7f4c2a
                         goto cleanup_threads;
7f4c2a
                 }
7f4c2a
@@ -1482,10 +1510,10 @@ br_rate_limit_signer (xlator_t *this, int child_count, int numbricks)
7f4c2a
 #endif
7f4c2a
 
7f4c2a
         if (!spec.rate)
7f4c2a
-                gf_log (this->name,
7f4c2a
-                GF_LOG_INFO, "[Rate Limit Info] \"FULL THROTTLE\"");
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_RATE_LIMIT_INFO,
7f4c2a
+                        "[Rate Limit Info] \"FULL THROTTLE\"");
7f4c2a
         else
7f4c2a
-                gf_log (this->name, GF_LOG_INFO,
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_RATE_LIMIT_INFO,
7f4c2a
                         "[Rate Limit Info] \"tokens/sec (rate): %lu, "
7f4c2a
                         "maxlimit: %lu\"", spec.rate, spec.maxlimit);
7f4c2a
 
7f4c2a
@@ -1540,17 +1568,18 @@ init (xlator_t *this)
7f4c2a
 {
7f4c2a
         int            i    = 0;
7f4c2a
         int32_t        ret  = -1;
7f4c2a
-	br_private_t  *priv = NULL;
7f4c2a
+        br_private_t  *priv = NULL;
7f4c2a
         xlator_list_t *trav = NULL;
7f4c2a
 
7f4c2a
-	if (!this->children) {
7f4c2a
-		gf_log (this->name, GF_LOG_ERROR, "FATAL: no children");
7f4c2a
-		goto out;
7f4c2a
-	}
7f4c2a
+        if (!this->children) {
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_NO_CHILD,
7f4c2a
+                        "FATAL: no children");
7f4c2a
+                goto out;
7f4c2a
+        }
7f4c2a
 
7f4c2a
         priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t);
7f4c2a
         if (!priv) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
7f4c2a
                         "failed to allocate memory (->priv)");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -1571,8 +1600,9 @@ init (xlator_t *this)
7f4c2a
                 priv->children[i].timer_pool =
7f4c2a
                                   mem_pool_new (struct gf_tw_timer_list,  4096);
7f4c2a
                 if (!priv->children[i].timer_pool) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "failed to allocate mem-pool for timer");
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
7f4c2a
+                                BRB_MSG_NO_MEMORY, "failed to allocate mem-pool"
7f4c2a
+                                " for timer");
7f4c2a
                         errno = ENOMEM;
7f4c2a
                         goto free_children;
7f4c2a
                 }
7f4c2a
@@ -1591,7 +1621,8 @@ init (xlator_t *this)
7f4c2a
 
7f4c2a
         priv->timer_wheel = glusterfs_global_timer_wheel (this);
7f4c2a
         if (!priv->timer_wheel) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRB_MSG_TIMER_WHEEL_UNAVAILABLE,
7f4c2a
                         "global timer wheel unavailable");
7f4c2a
                 goto cleanup_mutex;
7f4c2a
         }
7f4c2a
@@ -1613,13 +1644,13 @@ init (xlator_t *this)
7f4c2a
 
7f4c2a
         ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this);
7f4c2a
         if (ret != 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                        "thread creation failed (%s)", strerror (-ret));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
7f4c2a
+                        BRB_MSG_SPAWN_FAILED, "thread creation failed");
7f4c2a
                 ret = -1;
7f4c2a
         }
7f4c2a
 
7f4c2a
         if (!ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_INFO,
7f4c2a
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_BITROT_LOADED,
7f4c2a
                         "bit-rot xlator loaded in \"%s\" mode",
7f4c2a
                         (priv->iamscrubber) ? "SCRUBBER" : "SIGNER");
7f4c2a
                 return 0;
7f4c2a
@@ -1691,11 +1722,11 @@ reconfigure (xlator_t *this, dict_t *options)
7f4c2a
                 for (; i < priv->child_count; i++) {
7f4c2a
                         child = &priv->children[i];
7f4c2a
                         if (!child->child_up) {
7f4c2a
-                                gf_log (this->name, GF_LOG_INFO,
7f4c2a
-                                        "Brick %s is offline, skipping "
7f4c2a
-                                        "rescheduling (scrub would auto- "
7f4c2a
-                                        "schedule when brick is back online).",
7f4c2a
-                                        child->brick_path);
7f4c2a
+                                gf_msg (this->name, GF_LOG_INFO, 0,
7f4c2a
+                                        BRB_MSG_BRICK_INFO, "Brick %s is "
7f4c2a
+                                        "offline, skipping rescheduling (scrub"
7f4c2a
+                                        " would auto- schedule when brick is "
7f4c2a
+                                        "back online).", child->brick_path);
7f4c2a
                                 continue;
7f4c2a
                         }
7f4c2a
 
7f4c2a
@@ -1703,10 +1734,12 @@ reconfigure (xlator_t *this, dict_t *options)
7f4c2a
                         ret = br_fsscan_reschedule (this, child,
7f4c2a
                                                     fsscan, fsscrub, _gf_true);
7f4c2a
                         if (ret) {
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR, "Could not "
7f4c2a
-                                        "reschedule scrubber for brick: %s. "
7f4c2a
-                                        "Scubbing will continue according to "
7f4c2a
-                                        "old frequency.", child->brick_path);
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                        BRB_MSG_RESCHEDULE_SCRUBBER_FAILED,
7f4c2a
+                                        "Could not reschedule scrubber for "
7f4c2a
+                                        "brick: %s. Scubbing will continue "
7f4c2a
+                                        "according to old frequency.",
7f4c2a
+                                        child->brick_path);
7f4c2a
                         }
7f4c2a
                 }
7f4c2a
         }
7f4c2a
diff --git a/xlators/features/bit-rot/src/stub/Makefile.am b/xlators/features/bit-rot/src/stub/Makefile.am
7f4c2a
index 579dd1c..30e7ca7 100644
7f4c2a
--- a/xlators/features/bit-rot/src/stub/Makefile.am
7f4c2a
+++ b/xlators/features/bit-rot/src/stub/Makefile.am
7f4c2a
@@ -7,7 +7,7 @@ bitrot_stub_la_SOURCES = bit-rot-stub.c
7f4c2a
 bitrot_stub_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
7f4c2a
 
7f4c2a
 noinst_HEADERS = bit-rot-stub.h bit-rot-common.h bit-rot-stub-mem-types.h \
7f4c2a
-                 bit-rot-object-version.h
7f4c2a
+                 bit-rot-object-version.h bit-rot-stub-messages.h
7f4c2a
 
7f4c2a
 AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
7f4c2a
 
7f4c2a
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h
7f4c2a
new file mode 100644
7f4c2a
index 0000000..d940b65
7f4c2a
--- /dev/null
7f4c2a
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h
7f4c2a
@@ -0,0 +1,158 @@
7f4c2a
+/*
7f4c2a
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
7f4c2a
+ This file is part of GlusterFS.
7f4c2a
+
7f4c2a
+ This file is licensed to you under your choice of the GNU Lesser
7f4c2a
+ General Public License, version 3 or any later version (LGPLv3 or
7f4c2a
+ later), or the GNU General Public License, version 2 (GPLv2), in all
7f4c2a
+ cases as published by the Free Software Foundation.
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#ifndef _BITROT_STUB_MESSAGES_H_
7f4c2a
+#define _BITROT_STUB_MESSAGES_H_
7f4c2a
+
7f4c2a
+#include "glfs-message-id.h"
7f4c2a
+
7f4c2a
+/* file bit-rot-stub-messages.h
7f4c2a
+ * brief BIT-ROT log-message IDs and their descriptions
7f4c2a
+ */
7f4c2a
+
7f4c2a
+/* NOTE: Rules for message additions
7f4c2a
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
7f4c2a
+ *    if the message format is the same. Reasoning is that, if the message
7f4c2a
+ *    format needs to change in one instance, the other instances are not
7f4c2a
+ *    impacted or the new change does not change the ID of the instance being
7f4c2a
+ *    modified.
7f4c2a
+ * 2) Addition of a message,
7f4c2a
+ *       - Should increment the GLFS_NUM_MESSAGES
7f4c2a
+ *       - Append to the list of messages defined, towards the end
7f4c2a
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
7f4c2a
+ * NOTE: Rules for message format modifications
7f4c2a
+ * 3) Check acorss the code if the message ID macro in question is reused
7f4c2a
+ *    anywhere. If reused then then the modifications should ensure correctness
7f4c2a
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
7f4c2a
+ *    not used anywhere, proceed with the required modification.
7f4c2a
+ * NOTE: Rules for message deletion
7f4c2a
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
7f4c2a
+ *    anywhere, then can be deleted, but will leave a hole by design, as
7f4c2a
+ *    addition rules specify modification to the end of the list and not filling
7f4c2a
+ *    holes.
7f4c2a
+ */
7f4c2a
+
7f4c2a
+#define GLFS_BITROT_STUB_BASE                   GLFS_MSGID_COMP_BITROT_STUB
7f4c2a
+#define GLFS_BITROT_STUB_NUM_MESSAGES           15
7f4c2a
+#define GLFS_MSGID_END         (GLFS_BITROT_STUB_BASE + \
7f4c2a
+                                GLFS_BITROT_STUB_NUM_MESSAGES + 1)
7f4c2a
+/* Messaged with message IDs */
7f4c2a
+#define glfs_msg_start_x   GLFS_BITROT_STUB_BASE, "Invalid: Start of messages"
7f4c2a
+/*------------*/
7f4c2a
+
7f4c2a
+
7f4c2a
+#define BRS_MSG_NO_MEMORY                   (GLFS_BITROT_STUB_BASE + 1)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_SET_EVENT_FAILED            (GLFS_BITROT_STUB_BASE + 2)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_MEM_ACNT_FAILED             (GLFS_BITROT_STUB_BASE + 3)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_CREATE_FRAME_FAILED         (GLFS_BITROT_STUB_BASE + 4)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_SET_CONTEXT_FAILED          (GLFS_BITROT_STUB_BASE + 5)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_CHANGE_VERSION_FAILED       (GLFS_BITROT_STUB_BASE + 6)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_ADD_FD_TO_LIST_FAILED       (GLFS_BITROT_STUB_BASE + 7)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_SET_FD_CONTEXT_FAILED       (GLFS_BITROT_STUB_BASE + 8)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_CREATE_ANONYMOUS_FD_FAILED  (GLFS_BITROT_STUB_BASE + 9)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_NO_CHILD                    (GLFS_BITROT_STUB_BASE + 10)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_STUB_ALLOC_FAILED           (GLFS_BITROT_STUB_BASE + 11)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_GET_INODE_CONTEXT_FAILED    (GLFS_BITROT_STUB_BASE + 12)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_CANCEL_SIGN_THREAD_FAILED   (GLFS_BITROT_STUB_BASE + 13)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_ADD_FD_TO_INODE             (GLFS_BITROT_STUB_BASE + 14)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+#define BRS_MSG_SIGN_VERSION_ERROR          (GLFS_BITROT_STUB_BASE + 15)
7f4c2a
+/*!
7f4c2a
+ * @messageid
7f4c2a
+ * @diagnosis
7f4c2a
+ * @recommendedaction
7f4c2a
+ *
7f4c2a
+ */
7f4c2a
+/*------------*/
7f4c2a
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
7f4c2a
+#endif /* !_BITROT_STUB_MESSAGES_H_ */
7f4c2a
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
7f4c2a
index d4aecdc..600eb80 100644
7f4c2a
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
7f4c2a
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
7f4c2a
@@ -25,7 +25,7 @@
7f4c2a
 
7f4c2a
 #include "bit-rot-stub.h"
7f4c2a
 #include "bit-rot-stub-mem-types.h"
7f4c2a
-
7f4c2a
+#include "bit-rot-stub-messages.h"
7f4c2a
 #include "bit-rot-common.h"
7f4c2a
 
7f4c2a
 #define BR_STUB_REQUEST_COOKIE  0x1
7f4c2a
@@ -51,8 +51,8 @@ mem_acct_init (xlator_t *this)
7f4c2a
         ret = xlator_mem_acct_init (this, gf_br_stub_mt_end + 1);
7f4c2a
 
7f4c2a
         if (ret != 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING, "Memory accounting"
7f4c2a
-                        " init failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRS_MSG_MEM_ACNT_FAILED,
7f4c2a
+                        "Memory accounting init failed");
7f4c2a
                 return ret;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -65,12 +65,13 @@ init (xlator_t *this)
7f4c2a
         int32_t ret = 0;
7f4c2a
         char *tmp = NULL;
7f4c2a
         struct timeval tv = {0,};
7f4c2a
-	br_stub_private_t *priv = NULL;
7f4c2a
+        br_stub_private_t *priv = NULL;
7f4c2a
 
7f4c2a
-	if (!this->children) {
7f4c2a
-		gf_log (this->name, GF_LOG_ERROR, "FATAL: no children");
7f4c2a
-		goto error_return;
7f4c2a
-	}
7f4c2a
+        if (!this->children) {
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_NO_CHILD,
7f4c2a
+                        "FATAL: no children");
7f4c2a
+                goto error_return;
7f4c2a
+        }
7f4c2a
 
7f4c2a
         priv = GF_CALLOC (1, sizeof (*priv), gf_br_stub_mt_private_t);
7f4c2a
         if (!priv)
7f4c2a
@@ -99,7 +100,7 @@ init (xlator_t *this)
7f4c2a
         if (ret != 0)
7f4c2a
                 goto cleanup_lock;
7f4c2a
 
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG, "bit-rot stub loaded");
7f4c2a
+        gf_msg_debug (this->name, 0, "bit-rot stub loaded");
7f4c2a
 	this->private = priv;
7f4c2a
 
7f4c2a
         return 0;
7f4c2a
@@ -127,7 +128,8 @@ fini (xlator_t *this)
7f4c2a
 
7f4c2a
         ret = gf_thread_cleanup_xint (priv->signth);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_CANCEL_SIGN_THREAD_FAILED,
7f4c2a
                         "Could not cancel sign serializer thread");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -340,8 +342,9 @@ br_stub_need_versioning (xlator_t *this,
7f4c2a
 
7f4c2a
         ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr);
7f4c2a
         if (ret < 0) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
7f4c2a
-                        "context for the inode %s",
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
7f4c2a
+                        "inode context for the inode %s",
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto error_return;
7f4c2a
         }
7f4c2a
@@ -375,8 +378,9 @@ br_stub_anon_fd_ctx (xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx)
7f4c2a
         if (!br_stub_fd) {
7f4c2a
                 ret = br_stub_add_fd_to_inode (this, fd, ctx);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "failed to "
7f4c2a
-                                "add fd to the inode (gfid: %s)",
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                BRS_MSG_ADD_FD_TO_INODE, "failed to add fd to "
7f4c2a
+                                "the inode (gfid: %s)",
7f4c2a
                                 uuid_utoa (fd->inode->gfid));
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -397,8 +401,9 @@ br_stub_versioning_prep (call_frame_t *frame,
7f4c2a
 
7f4c2a
         local = br_stub_alloc_local (this);
7f4c2a
         if (!local) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "local allocation failed "
7f4c2a
-                        "(gfid: %s)", uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRS_MSG_NO_MEMORY,
7f4c2a
+                        "local allocation failed (gfid: %s)",
7f4c2a
+                        uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto error_return;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -693,9 +698,10 @@ br_stub_compare_sign_version (xlator_t *this,
7f4c2a
                 if (ctx->currentversion < sbuf->signedversion) {
7f4c2a
                         invalid = _gf_true;
7f4c2a
                 } else if (ctx->currentversion > sbuf->signedversion) {
7f4c2a
-                        gf_log (this->name, GF_LOG_DEBUG, "\"Signing version\" "
7f4c2a
-                                "(%lu) lower than \"Current version \" (%lu)",
7f4c2a
-                                ctx->currentversion, sbuf->signedversion);
7f4c2a
+                        gf_msg_debug (this->name, 0, "\"Signing version\" "
7f4c2a
+                                      "(%lu) lower than \"Current version \" "
7f4c2a
+                                      "(%lu)", ctx->currentversion,
7f4c2a
+                                      sbuf->signedversion);
7f4c2a
                         *fakesuccess = 1;
7f4c2a
                 }
7f4c2a
         }
7f4c2a
@@ -703,9 +709,10 @@ br_stub_compare_sign_version (xlator_t *this,
7f4c2a
 
7f4c2a
         if (invalid) {
7f4c2a
                 ret = -1;
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
-                        "Signing version exceeds current version [%lu > %lu]",
7f4c2a
-                        sbuf->signedversion, ctx->currentversion);
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0,
7f4c2a
+                        BRS_MSG_SIGN_VERSION_ERROR, "Signing version exceeds "
7f4c2a
+                        "current version [%lu > %lu]", sbuf->signedversion,
7f4c2a
+                        ctx->currentversion);
7f4c2a
         }
7f4c2a
 
7f4c2a
  out:
7f4c2a
@@ -875,9 +882,9 @@ br_stub_handle_object_reopen (call_frame_t *frame,
7f4c2a
         stub = fop_fsetxattr_cbk_stub (frame, br_stub_fsetxattr_resume,
7f4c2a
                                        0, 0, NULL);
7f4c2a
         if (!stub) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
7f4c2a
-                        "fsetxattr fop (gfid: %s), unwinding",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
7f4c2a
+                        "failed to allocate stub for fsetxattr fop (gfid: %s),"
7f4c2a
+                        " unwinding", uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto cleanup_local;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1003,8 +1010,9 @@ br_stub_is_object_stale (xlator_t *this, call_frame_t *frame, inode_t *inode,
7f4c2a
 
7f4c2a
         ret = br_stub_get_inode_ctx (this, inode, &ctx_addr);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
7f4c2a
-                        "context for %s", uuid_utoa (inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
7f4c2a
+                        "inode context for %s", uuid_utoa (inode->gfid));
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1389,9 +1397,9 @@ br_stub_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
7f4c2a
                                 offset, flags, iobref, xdata);
7f4c2a
 
7f4c2a
         if (!stub) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
7f4c2a
-                        "write fop (gfid: %s), unwinding",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
7f4c2a
+                        "failed to allocate stub for write fop (gfid: %s), "
7f4c2a
+                        "unwinding", uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto cleanup_local;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1496,9 +1504,9 @@ br_stub_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
7f4c2a
         stub = fop_ftruncate_stub (frame, br_stub_ftruncate_resume, fd, offset,
7f4c2a
                                    xdata);
7f4c2a
         if (!stub) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
7f4c2a
-                        "ftruncate fop (gfid: %s), unwinding",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
7f4c2a
+                        "failed to allocate stub for ftruncate fop (gfid: %s),"
7f4c2a
+                        " unwinding", uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto cleanup_local;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1597,8 +1605,10 @@ br_stub_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
7f4c2a
 
7f4c2a
         fd = fd_anonymous (loc->inode);
7f4c2a
         if (!fd) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to create anonymous "
7f4c2a
-                        "fd for the inode %s", uuid_utoa (loc->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_CREATE_ANONYMOUS_FD_FAILED, "failed to create "
7f4c2a
+                        "anonymous fd for the inode %s",
7f4c2a
+                        uuid_utoa (loc->inode->gfid));
7f4c2a
                 goto unwind;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1624,9 +1634,9 @@ br_stub_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
7f4c2a
         stub = fop_truncate_stub (frame, br_stub_truncate_resume, loc, offset,
7f4c2a
                                   xdata);
7f4c2a
         if (!stub) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
7f4c2a
-                        "truncate fop (gfid: %s), unwinding",
7f4c2a
-                        uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
7f4c2a
+                        "failed to allocate stub for truncate fop (gfid: %s), "
7f4c2a
+                        "unwinding", uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto cleanup_local;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1690,8 +1700,9 @@ br_stub_open (call_frame_t *frame, xlator_t *this,
7f4c2a
 
7f4c2a
         ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
7f4c2a
-                        "context for the file %s (gfid: %s)", loc->path,
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
7f4c2a
+                        "inode context for the file %s (gfid: %s)", loc->path,
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto unwind;
7f4c2a
         }
7f4c2a
@@ -1702,8 +1713,10 @@ br_stub_open (call_frame_t *frame, xlator_t *this,
7f4c2a
 
7f4c2a
         ret = br_stub_add_fd_to_inode (this, fd, ctx);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed add fd to the list "
7f4c2a
-                        "(gfid: %s)", uuid_utoa (fd->inode->gfid));
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_ADD_FD_TO_LIST_FAILED,
7f4c2a
+                        "failed add fd to the list (gfid: %s)",
7f4c2a
+                        uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto unwind;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1735,7 +1748,8 @@ br_stub_add_fd_to_inode (xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx)
7f4c2a
 
7f4c2a
         ret = br_stub_require_release_call (this, fd, &br_stub_fd);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "failed to set the fd "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        BRS_MSG_SET_FD_CONTEXT_FAILED, "failed to set the fd "
7f4c2a
                         "context for the file (gfid: %s)",
7f4c2a
                         uuid_utoa (fd->inode->gfid));
7f4c2a
                 goto out;
7f4c2a
@@ -2123,7 +2137,7 @@ br_stub_send_ipc_fop (xlator_t *this, fd_t *fd, unsigned long releaseversion,
7f4c2a
 
7f4c2a
         xdata = dict_new ();
7f4c2a
         if (!xdata) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, ENOMEM, BRS_MSG_NO_MEMORY,
7f4c2a
                         "dict allocation failed: cannot send IPC FOP "
7f4c2a
                         "to changelog");
7f4c2a
                 goto out;
7f4c2a
@@ -2132,14 +2146,16 @@ br_stub_send_ipc_fop (xlator_t *this, fd_t *fd, unsigned long releaseversion,
7f4c2a
         ret = dict_set_static_bin (xdata,
7f4c2a
                                    "RELEASE-EVENT", &ev, CHANGELOG_EV_SIZE);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRS_MSG_SET_EVENT_FAILED,
7f4c2a
                         "cannot set release event in dict");
7f4c2a
                 goto dealloc_dict;
7f4c2a
         }
7f4c2a
 
7f4c2a
         frame = create_frame (this, this->ctx->pool);
7f4c2a
         if (!frame) {
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING, "create_frame() failure");
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0,
7f4c2a
+                        BRS_MSG_CREATE_FRAME_FAILED,
7f4c2a
+                        "create_frame() failure");
7f4c2a
                 goto dealloc_dict;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -2245,10 +2261,10 @@ br_stub_release (xlator_t *this, fd_t *fd)
7f4c2a
         UNLOCK (&inode->lock);
7f4c2a
 
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_DEBUG,
7f4c2a
-                        "releaseversion: %lu | flags: %d | signinfo: %d",
7f4c2a
-                        (unsigned long) ntohl (releaseversion),
7f4c2a
-                        flags, ntohl(signinfo));
7f4c2a
+                gf_msg_debug (this->name, 0, "releaseversion: %lu | flags: %d "
7f4c2a
+                              "| signinfo: %d",
7f4c2a
+                              (unsigned long) ntohl (releaseversion), flags,
7f4c2a
+                              ntohl(signinfo));
7f4c2a
                 br_stub_send_ipc_fop (this, fd, releaseversion, signinfo);
7f4c2a
         }
7f4c2a
 
7f4c2a
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.h b/xlators/features/bit-rot/src/stub/bit-rot-stub.h
7f4c2a
index 9304ef8..48c7a37 100644
7f4c2a
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.h
7f4c2a
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.h
7f4c2a
@@ -24,6 +24,7 @@
7f4c2a
 #include "bit-rot-stub-mem-types.h"
7f4c2a
 
7f4c2a
 #include "bit-rot-common.h"
7f4c2a
+#include "bit-rot-stub-messages.h"
7f4c2a
 
7f4c2a
 typedef int (br_stub_version_cbk) (call_frame_t *, void *,
7f4c2a
                                    xlator_t *, int32_t, int32_t, dict_t *);
7f4c2a
@@ -223,7 +224,8 @@ br_stub_require_release_call (xlator_t *this, fd_t *fd, br_stub_fd_t **fd_ctx)
7f4c2a
 
7f4c2a
         ret = br_stub_fd_ctx_set (this, fd, br_stub_fd);
7f4c2a
         if (ret)
7f4c2a
-                gf_log (this->name, GF_LOG_WARNING,
7f4c2a
+                gf_msg (this->name, GF_LOG_WARNING, 0,
7f4c2a
+                        BRS_MSG_SET_CONTEXT_FAILED,
7f4c2a
                         "could not set fd context (for release callback");
7f4c2a
         else
7f4c2a
                 *fd_ctx = br_stub_fd;
7f4c2a
@@ -277,7 +279,8 @@ __br_stub_set_ongoing_version (br_stub_inode_ctx_t *ctx, unsigned long version)
7f4c2a
         if (ctx->currentversion < version)
7f4c2a
                 ctx->currentversion = version;
7f4c2a
         else
7f4c2a
-                gf_log ("bit-rot-stub", GF_LOG_WARNING, "current version: %lu"
7f4c2a
+                gf_msg ("bit-rot-stub", GF_LOG_WARNING, 0,
7f4c2a
+                        BRS_MSG_CHANGE_VERSION_FAILED, "current version: %lu"
7f4c2a
                         "new version: %lu", ctx->currentversion, version);
7f4c2a
 }
7f4c2a
 
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a