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