summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-06-25 12:07:24 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-06-25 06:09:26 -0700
commitdf77ac5088ebe1a1645489d77bdae77ce6cbc828 (patch)
tree10106364d8a2a01fdfd219dc3ed26c53f6158671 /xlators/features/bit-rot
parent913631a0edffaefc0fae73df46f80e19422ebed9 (diff)
features/bitrot: convert pending gf_log() to gf_msg()
Change-Id: Idfd245327b485459ccbda503510b8ca0127bb66c BUG: 1231619 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/11396 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h27
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c32
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-ssm.c12
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c32
4 files changed, 73 insertions, 30 deletions
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
index af3a74fc752..b4746bb5ecb 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
@@ -387,5 +387,32 @@
*
*/
/*------------*/
+#define BRB_MSG_SCRUB_THREAD_CLEANUP (GLFS_BITROT_BITD_BASE + 49)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+/*------------*/
+#define BRB_MSG_SCRUBBER_CLEANED (GLFS_BITROT_BITD_BASE + 50)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+/*------------*/
+#define BRB_MSG_GENERIC_SSM_INFO (GLFS_BITROT_BITD_BASE + 51)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+/*------------*/
+#define BRB_MSG_ZERO_TIMEOUT_BUG (GLFS_BITROT_BITD_BASE + 52)
+
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
#endif /* !_BITROT_BITD_MESSAGES_H_ */
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index ee50c8c97b7..15cb916dcb3 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -537,11 +537,12 @@ br_fsscan_deactivate (xlator_t *this, br_child_t *child)
ret = gf_tw_del_timer (priv->timer_wheel, fsscan->timer);
if (ret == 0) {
nstate = BR_SCRUB_STATE_STALLED;
- gf_log (this->name, GF_LOG_INFO, "Brick [%s] is under active "
- "scrubbing. Pausing scrub..", child->brick_path);
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,
+ "Brick [%s] is under active scrubbing. Pausing scrub..",
+ child->brick_path);
} else {
nstate = BR_SCRUB_STATE_PAUSED;
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,
"Scrubber paused [Brick: %s]", child->brick_path);
}
@@ -612,8 +613,9 @@ br_fsscanner_exit_control (xlator_t *this, br_child_t *child)
if (fsscan->state == BR_SCRUB_STATE_ACTIVE) {
(void) br_fsscan_activate (this, child);
} else {
- gf_log (this->name, GF_LOG_INFO, "Brick [%s] waiting "
- "to get rescheduled..", child->brick_path);
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,
+ "Brick [%s] waiting to get rescheduled..",
+ child->brick_path);
}
}
UNLOCK (&child->lock);
@@ -752,7 +754,8 @@ br_fsscan_schedule (xlator_t *this, br_child_t *child)
timo = br_fsscan_calculate_timeout (fsscan->boot,
fsscan->boot, fsscrub->frequency);
if (timo == 0) {
- gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout");
+ gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG,
+ "BUG: Zero schedule timeout");
goto error_return;
}
@@ -800,7 +803,8 @@ br_fsscan_activate (xlator_t *this, br_child_t *child)
timo = br_fsscan_calculate_timeout (fsscan->boot,
now.tv_sec, fsscrub->frequency);
if (timo == 0) {
- gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout");
+ gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG,
+ "BUG: Zero schedule timeout");
return -1;
}
@@ -810,8 +814,8 @@ br_fsscan_activate (xlator_t *this, br_child_t *child)
(void) gf_tw_mod_timer (priv->timer_wheel, fsscan->timer, timo);
_br_child_set_scrub_state (child, BR_SCRUB_STATE_PENDING);
- gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled to run "
- "at %s", child->brick_path, timestr);
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, "Scrubbing for "
+ "%s rescheduled to run at %s", child->brick_path, timestr);
return 0;
}
@@ -835,7 +839,8 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child)
timo = br_fsscan_calculate_timeout (fsscan->boot,
now.tv_sec, fsscrub->frequency);
if (timo == 0) {
- gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout");
+ gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG,
+ "BUG: Zero schedule timeout");
return -1;
}
@@ -845,13 +850,14 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child)
fsscan->over = _gf_false;
ret = gf_tw_mod_timer_pending (priv->timer_wheel, fsscan->timer, timo);
if (ret == 0)
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,
"Scrubber for %s is currently running and would be "
"rescheduled after completion", child->brick_path);
else {
_br_child_set_scrub_state (child, BR_SCRUB_STATE_PENDING);
- gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled "
- "to run at %s", child->brick_path, timestr);
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,
+ "Scrubbing for %s rescheduled to run at %s",
+ child->brick_path, timestr);
}
return 0;
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c
index c95e5551c0d..fcffc04feda 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c
@@ -10,6 +10,7 @@
#include "bit-rot-ssm.h"
#include "bit-rot-scrub.h"
+#include "bit-rot-bitd-messages.h"
int br_scrub_ssm_noop (xlator_t *this, br_child_t *child)
{
@@ -19,7 +20,7 @@ int br_scrub_ssm_noop (xlator_t *this, br_child_t *child)
int
br_scrub_ssm_state_pause (xlator_t *this, br_child_t *child)
{
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,
"Scrubber paused [Brick: %s]", child->brick_path);
_br_child_set_scrub_state (child, BR_SCRUB_STATE_PAUSED);
return 0;
@@ -28,7 +29,7 @@ br_scrub_ssm_state_pause (xlator_t *this, br_child_t *child)
int
br_scrub_ssm_state_ipause (xlator_t *this, br_child_t *child)
{
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,
"Scrubber paused [Brick: %s]", child->brick_path);
_br_child_set_scrub_state (child, BR_SCRUB_STATE_IPAUSED);
return 0;
@@ -42,7 +43,7 @@ br_scrub_ssm_state_active (xlator_t *this, br_child_t *child)
if (fsscan->over) {
(void) br_fsscan_activate (this, child);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,
"Scrubbing resumed [Brick %s]", child->brick_path);
_br_child_set_scrub_state (child, BR_SCRUB_STATE_ACTIVE);
}
@@ -53,8 +54,9 @@ br_scrub_ssm_state_active (xlator_t *this, br_child_t *child)
int
br_scrub_ssm_state_stall (xlator_t *this, br_child_t *child)
{
- gf_log (this->name, GF_LOG_INFO, "Brick [%s] is under active "
- "scrubbing. Pausing scrub..", child->brick_path);
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,
+ "Brick [%s] is under active scrubbing. Pausing scrub..",
+ child->brick_path);
_br_child_set_scrub_state (child, BR_SCRUB_STATE_STALLED);
return 0;
}
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index e822d535a18..f58354a27c3 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -1259,7 +1259,8 @@ br_child_enaction (xlator_t *this, br_child_t *child, br_stub_init_t *stub)
if (!ret) {
child->witnessed = 1;
_br_set_child_state (child, BR_CHILD_STATE_CONNECTED);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ 0, BRB_MSG_CONNECTED_TO_BRICK,
"Connected to brick %s..", child->brick_path);
}
}
@@ -1384,7 +1385,8 @@ br_cleanup_scrubber (xlator_t *this, br_child_t *child)
*/
ret = gf_thread_cleanup_xint (child->thread);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_INFO,
+ 0, BRB_MSG_SCRUB_THREAD_CLEANUP,
"Error cleaning up scanner thread");
/**
@@ -1402,7 +1404,8 @@ br_cleanup_scrubber (xlator_t *this, br_child_t *child)
*/
_br_child_set_scrub_state (child, BR_SCRUB_STATE_INACTIVE);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ 0, BRB_MSG_SCRUBBER_CLEANED,
"Cleaned up scrubber for brick [%s]", child->brick_path);
return 0;
@@ -1517,8 +1520,9 @@ _br_qchild_event (xlator_t *this, br_child_t *child, br_child_handler *call)
childev = GF_CALLOC (1, sizeof (*childev), gf_br_mt_br_child_event_t);
if (!childev) {
- gf_log (this->name, GF_LOG_ERROR, "Event unhandled for "
- "child.. [Brick: %s]", child->xl->name);
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
+ "Event unhandled for child.. [Brick: %s]",
+ child->xl->name);
return;
}
@@ -1800,7 +1804,8 @@ br_init_children (xlator_t *this, br_private_t *priv)
child->timer_pool = mem_pool_new
(struct gf_tw_timer_list, 4096);
if (!child->timer_pool) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR,
+ ENOMEM, BRB_MSG_NO_MEMORY,
"failed to allocate mem-pool for timer");
errno = ENOMEM;
goto freechild;
@@ -1827,13 +1832,14 @@ init (xlator_t *this)
br_private_t *priv = NULL;
if (!this->children) {
- gf_log (this->name, GF_LOG_ERROR, "FATAL: no children");
+ gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_NO_CHILD,
+ "FATAL: no children");
goto out;
}
priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t);
if (!priv) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
"failed to allocate memory (->priv)");
goto out;
}
@@ -1925,9 +1931,10 @@ br_reconfigure_child (xlator_t *this, br_child_t *child)
ret = br_scrub_state_machine (this, child);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Could not reschedule scrubber for brick: %s. "
- "Scubbing will continue according to old frequency.",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ BRB_MSG_RESCHEDULE_SCRUBBER_FAILED,
+ "Could not reschedule scrubber for brick: %s. Scubbing "
+ "will continue according to old frequency.",
child->brick_path);
}
}
@@ -1958,7 +1965,8 @@ br_reconfigure_scrubber (xlator_t *this, dict_t *options)
LOCK (&child->lock);
{
if (_br_child_failed_conn (child)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ 0, BRB_MSG_BRICK_INFO,
"Scrubber for brick [%s] failed "
"initialization, rescheduling is "
"skipped", child->brick_path);